AWS Security Hub · RDS
RDS.42: RDS MariaDB should export logs to CW
Written and reviewed by Emnode · Last reviewed
What does AWS Security Hub RDS.42 check?
RDS.42 checks whether an RDS for MariaDB instance (AWS::RDS::DBInstance) publishes its logs to CloudWatch Logs. It knows four log types (audit, error, general, and slowquery) and by default expects at least audit and error to be exported, failing the instance otherwise. It is evaluated periodically.
Why does RDS.42 matter?
A MariaDB instance writes its error, general, slow-query, and audit logs to the managed database host by default. You can view recent slices in the console or pull them with an API call, but they rotate, are size-capped, and vanish the moment the instance is replaced, scaled, or fails over. Logs you can't reach are logs you can't use: the difference between "the evidence rotated away" and "here is exactly who connected, what ran, and when."
How do I fix RDS.42?
- Enable the export with modify-db-instance --cloudwatch-logs-exports-configuration 'EnableLogTypes=["audit","error"]' (add slowquery as useful; avoid general in production for cost).
- Set a retention policy on the resulting log groups.
- Build metric filters and alarms on the exported streams.
- Standardise the export across MariaDB instances in IaC.
Remediation script · bash
# Verify the prerequisite first: API Gateway's account-level CloudWatch role.
# Without it, the logging setting saves but no logs ever flow.
aws apigateway get-account --query 'cloudwatchRoleArn' --output text
# Enable ERROR-level execution logging on every stage of a REST API.
REST_API=a1b2c3d4e5
for STAGE in $(aws apigateway get-stages --rest-api-id $REST_API \
--query 'item[].stageName' --output text); do
aws apigateway update-stage --rest-api-id $REST_API --stage-name $STAGE \
--patch-operations op=replace,path=/*/*/logging/loglevel,value=ERROR
done
# Cap retention on the log group so storage stays bounded (do this every time you enable logging).
aws logs put-retention-policy \
--log-group-name "API-Gateway-Execution-Logs_${REST_API}/prod" \
--retention-in-days 90
# Example for a managed database: publish engine logs to CloudWatch (no per-event charge).
aws rds modify-db-instance --db-instance-identifier prod-db \
--cloudwatch-logs-export-configuration 'EnableLogTypes=["error","audit"]' --apply-immediatelyFull walkthrough (console steps, edge cases and verification) in the lesson Enable application and API logging.
Is RDS.42 a false positive?
The control defaults to expecting both audit and error exports, so a MariaDB instance that deliberately ships only its error log (a common, cost-conscious choice where the audit log is high-volume and the workload doesn't warrant connection-level auditing) fails even though the configuration is intentional. The logTypes parameter is customisable: if you genuinely only require, say, error and slowquery, retune the parameter to match your real logging standard so the control measures the right thing rather than suppressing a finding against the default. Suppression is the right move instead only when a specific instance is a documented exception to an otherwise-standard export set (for example a throwaway sandbox), recorded with an owner and a review date rather than left as a silent miss.
More RDS controls
- RDS.1An RDS snapshot is shared publicly
- RDS.2An RDS instance is publicly accessible from the internet
- RDS.3RDS DB instances should be encrypted at rest
- RDS.4RDS snapshots should be encrypted at rest
- RDS.5RDS DB instances should use multiple AZs
- RDS.6RDS lacks enhanced monitoring
- RDS.7RDS clusters should have deletion protection
- RDS.8RDS DB instances should have deletion protection
- RDS.9RDS engine logs are not shipped to CloudWatch
- RDS.10RDS relies on long-lived database passwords
- RDS.11RDS instances should have automatic backups
- RDS.12IAM auth should be configured for RDS clusters