Export RDS MySQL Slow Query Logs to CloudWatch Logs
A company is using Amazon RDS for MySQL and needs to monitor slow queries to optimize database performance. The team has enabled slow query logs and wants to centralize logging in Amazon CloudWatch Logs for real-time analysis and alerting. Which solution meets these requirements with minimal operational overhead?
Quick Answer
The answer is to modify the DB parameter group to enable slow_query_log and set log_output to FILE, then configure the RDS instance to publish the slowquery log file to CloudWatch Logs. This is correct because RDS for MySQL natively supports streaming slow query logs directly to CloudWatch Logs when the log_output parameter is set to FILE, which writes the logs to the database host’s file system, and the RDS console or CLI can then automatically publish that file to a CloudWatch log group without any additional infrastructure. On the AWS Certified DevOps Engineer Professional DOP-C02 exam, this question tests your ability to distinguish between native RDS log export features and more complex workarounds; a common trap is confusing Enhanced Monitoring (which provides OS metrics) or Performance Insights (which offers a performance schema dashboard) with actual log streaming. Remember the key pairing: slow_query_log=1 and log_output=FILE, then enable the export—think “FILE to CloudWatch, no extra stack.”
Answer choices
Why each option matters
Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.
Correct answer & explanation
✓
Modify the DB parameter group to enable slow_query_log and set log_output to FILE, then configure the RDS instance to publish the slowquery log file to CloudWatch Logs.
RDS for MySQL can natively stream slow query logs to CloudWatch Logs. This is achieved by modifying the DB parameter group to set 'slow_query_log' to 1 and 'log_output' to 'FILE', then enabling the 'slowquery' log export in the RDS console or CLI. This approach requires no additional infrastructure, minimizing operational overhead. Option A is incorrect because Performance Insights focuses on database performance metrics and schema analysis, not slow query log streaming to CloudWatch. Option B is incorrect because Enhanced Monitoring provides OS-level metrics (CPU, memory, etc.), not slow query logs. Option D is incorrect because exporting logs to S3 and using Lambda adds unnecessary complexity and latency; the native CloudWatch integration is more efficient.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Enable Performance Insights on the RDS instance and use the Performance Insights dashboard to view slow queries.
Why it's wrong here
Performance Insights provides a performance schema, not slow query logs in CloudWatch.
- ✗
Enable Enhanced Monitoring on the RDS instance and configure CloudWatch alarms based on the metrics.
Why it's wrong here
Enhanced Monitoring provides OS-level metrics like CPU and memory, not slow query logs.
- ✓
Modify the DB parameter group to enable slow_query_log and set log_output to FILE, then configure the RDS instance to publish the slowquery log file to CloudWatch Logs.
Why this is correct
RDS can natively publish slow query logs to CloudWatch Logs via the 'slowquery' log export.
- ✗
Configure the RDS instance to export slow query logs to an S3 bucket, then set up a Lambda function to read the logs and send them to CloudWatch Logs.
Why it's wrong here
This adds unnecessary complexity; RDS can directly publish logs to CloudWatch.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
About these practice questions
Courseiva writes every DOP-C02 question from scratch — 1,013 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →
Same concept, more angles
1 more way this is tested on DOP-C02
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A company uses Amazon RDS for MySQL and wants to monitor slow queries to optimize performance. Which actions should the DevOps engineer take to capture and analyze slow query logs? (Choose THREE.)
hard- A.Use AWS CloudTrail to capture SQL queries
- ✓ B.Enable the slow query log parameter in the RDS DB parameter group
- C.Enable RDS Performance Insights
- ✓ D.Configure RDS to publish logs to Amazon CloudWatch Logs
- ✓ E.Use CloudWatch Logs Insights to query and analyze the slow query logs
Why B: To capture and analyze slow query logs in Amazon RDS for MySQL, the DevOps engineer should enable the slow query log parameter in the DB parameter group (B), configure RDS to publish logs to Amazon CloudWatch Logs (D), and use CloudWatch Logs Insights to query and analyze the logs (E). Option A (CloudTrail) captures API activity, not SQL queries. Option C (Performance Insights) monitors database performance metrics but does not capture slow query logs.
JA
Written by Johnson Ajibi, MSc IT Security
Senior Network & Security Engineer · founder of Courseiva
This DOP-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DOP-C02 exam.