AWS RDS Aurora开启日志后general_log与slow_log表为空问题咨询
mysql.general_log in Aurora 5.6 Cluster Let’s break down why your general log table is empty despite enabling logging via your CloudFormation parameter group. For Aurora 5.6, there are a few critical details you might have missed:
1. You’re using the wrong parameter group type
The general_log parameter is an instance-level setting, not a cluster-level one. Your current configuration applies it to a DBClusterParameterGroup, but Aurora ignores cluster-level settings for instance-specific parameters like this.
To fix this, you need to create a DBInstanceParameterGroup instead (or in addition) and attach it to each instance in your Aurora cluster. Here’s how to adjust your CloudFormation template:
DBInstanceParameterGroup: Type: "AWS::RDS::DBInstanceParameterGroup" Properties: Description: "Instance Parameter Group with enabled logging" Family: aurora5.6 Parameters: slow_query_log: 1 general_log: 1 log_output: TABLE long_query_time: 2
Then ensure each AWS::RDS::DBInstance resource in your template references this parameter group via the DBParameterGroupName attribute.
2. Your parameter changes haven’t been applied
Even if you fix the parameter group type, some RDS parameters require an instance restart to take effect. If you haven’t restarted your Aurora instances since applying the parameter group, the logging settings aren’t active yet.
Head to the AWS RDS console, select your Aurora cluster, go to the "Instances" tab, and restart each instance. Alternatively, use the AWS CLI command:
aws rds reboot-db-instance --db-instance-identifier <your-instance-id>
3. You’re querying the wrong instance’s log table
When log_output=TABLE is enabled, the general log is stored locally on each instance, not in a shared cluster table. If you’re connected to a read replica (instead of the primary instance), you won’t see logs from write operations (or operations executed on other instances).
Make sure you’re connecting directly to the primary Aurora instance when querying mysql.general_log. You can verify which instance is primary by checking the "Role" column in the RDS console’s instance list.
4. Double-check permissions (less likely, but worth ruling out)
While you mentioned you can query other mysql tables, confirm your user account has SELECT permissions on mysql.general_log. Run this query to check:
SHOW GRANTS FOR CURRENT_USER;
If permissions are missing, grant them with:
GRANT SELECT ON mysql.general_log TO 'your-user'@'%';
Once you address these points, your general log table should start populating with query data.
内容的提问来源于stack exchange,提问作者Jozef

