A rule stating that database logging should be enabled for security purposes.
Rule | Database logging should be enabled |
Framework | AWS Foundational Security Best Practices |
Severity | ✔ Medium |
Enable Database Logging for AWS Foundational Security Best Practices
Rule Description:
Enabling database logging is an essential security best practice for AWS resources. This rule ensures that database logging is enabled in order to monitor and analyze database activity, and to detect any suspicious or unauthorized activities that may pose a security risk.
Troubleshooting Steps:
If database logging is not enabled or encountering issues, follow these troubleshooting steps:
Necessary Code:
Depending on the database engine being used, there may be specific code snippets required to enable database logging. Below are examples for some popular database engines:
Amazon RDS for MySQL:
To enable database logging for Amazon RDS MySQL databases, run the following SQL command:
CALL mysql.rds_set_configuration('general_log', '1');
Amazon RDS for PostgreSQL:
To enable database logging for Amazon RDS PostgreSQL databases, update the PostgreSQL configuration file (
postgresql.conf
) by setting the logging_collector
parameter to on
. Restart the PostgreSQL database for the changes to take effect.Amazon Aurora:
To enable database logging for Amazon Aurora MySQL or PostgreSQL databases, follow the instructions provided for their respective database engines (MySQL or PostgreSQL).
Please refer to the AWS documentation for the database engine you are using for the most up-to-date instructions on enabling database logging.
Step-by-Step Guide for Remediation:
By following these steps, you will successfully enable database logging for your AWS resources, ensuring compliance with the AWS Foundational Security Best Practices.