0

I enabled the slow query logging on my AWS mariadb RDS as described here. And set up the publishing to Cloudwatch logs.

Parameter group family:

mariadb10.11

My parameters:

log_output = FILE
log_slow_query_time = 0.2
log_slow_query  = 1

This works, as my slow querys are logged to Cloudwatch

2024-08-21T11:13:15.000Z
# Time: 240821 11:13:15# User@Host: user[user] @ [1.2.3.4]
# Thread_id: 851891  Schema: dpd  QC_hit: No
# Query_time: 0.301404  Lock_time: 0.000000  Rows_sent: 1  Rows_examined: 0
# Rows_affected: 0  Bytes_sent: 59
use db_name;
SET timestamp=1724932120;
SELECT SLEEP(0.3)
LIMIT 0, 200;

But in addition to that there are also many log rows, that usually come after that.

2024-08-21T11:13:15.000Z
Time Id Command Argument

2024-08-21T11:13:15.000Z
Time Id Command Argument

2024-08-21T11:13:15.000Z
Time Id Command Argument

This makes it harder to find the actual slow query. How can this be disabled?

I have tried:

log_slow_min_examined_row_limit = 1

But with this parameter still these rows appear

9
  • The answer might be you can't, this is just how the databases are set up to write occasional log headers. I'm guessing you have multi-AZ redundancy and that's triggering the duplicate headers? Commented Aug 29, 2024 at 17:37
  • 1
    The "Time Id Command Argument" occurs on [flush [slow] logs](mariadb.com/kb/en/flush). Given the precise 15 minute increment this appears to be a scripted event. If its always the same time, enable the general log around this interval and look what was executed. 3 flushes at the same time seems excessive. Commented Aug 30, 2024 at 5:19
  • I am not using multi-AZ database. @Rup Commented Sep 4, 2024 at 8:47
  • Appears, that the flushes are every 5 minutes, so new log lines appear every 5 min. In slowquery.log there are these lines after slow query /rdsdbbin/mysql/bin/mysqld, Version: 10.11.8-MariaDB-log (managed by https://aws.amazon.com/rds/). started with: Tcp port: 3306 Unix socket: /tmp/mysql.sock Time Id Command Argument So this means CW does not have the timestamp, thus takes the same time as slow query was logged. And these are logged every 5 minutes until the slow log file rotates. Rotation is done every hour once. But still can it not be turned off? Commented Sep 4, 2024 at 9:01
  • That's a question for MariaDB really, if they support turning off writing the log flush headers when there's nothing to flush. And then AWS to work out how to configure that. I might ask AWS directly in the first instance anyway. Commented Sep 4, 2024 at 10:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.