I am running mariadb 10.3.39 in RHEL with the below configuration in my.cnf.d/mariadb-server.cnf
[mariadb]
log_error=/var/log/mariadb/mariadb.log
When showing error logs in the file, I am seeing an issue where for the timestamp if its less than 10, its appending a space to it, instead of 0. This is causing issues with parsing of log when sending to ELK. Is this a know issue, any ways to make it standardized ?
2024-09-26 4:10:08 0 [Note] Server socket created on IP: '0.0.0.0'.
2024-09-26 4:10:08 0 [Note] Reading of all Master_info entries succeeded
2024-09-26 4:10:08 0 [Note] Added new Master_info '' to hash table
Below is the variables set for date formats,
MariaDB [(none)]> show variables like '%date%';
+-----------------------------------------+-------------------+
| Variable_name | Value |
+-----------------------------------------+-------------------+
| binlog_direct_non_transactional_updates | OFF |
| date_format | %Y-%m-%d |
| datetime_format | %Y-%m-%d %H:%i:%s |
| log_slave_updates | OFF |
| low_priority_updates | OFF |
| query_cache_wlock_invalidate | OFF |
| sql_safe_updates | OFF |
+-----------------------------------------+-------------------+
7 rows in set (0.001 sec)
1
You can’t modify the format in the error log since it is hardcoded in function print_buffer_to_file():
fprintf_stderr( "%d-%02d-%02d %2d:%02d:%02d %lu [%s] %.*s%.*sn",
...
Same in MySQL (print_timestamp):
my_b_printf(file, "%02d%02d%02d %2d:%02d:%02d", res->tm_year % 100,