Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
N/A
-
None
-
Can result in unexpected behaviour
Description
MDEV-18386 Introduced adding a timestamp formats when the audit login writes to a file.
INSTALL PLUGIN server_audit SONAME 'server_audit'; |
SET GLOBAL server_audit_output_type=file; |
SET GLOBAL server_audit_events='query'; |
SET GLOBAL server_audit_file_path='bug.log'; |
SET GLOBAL server_audit_timestamp_format='%H:%i:%s.%f'; |
SET GLOBAL server_audit_logging=ON; |
SELECT 1; |
SELECT 2; |
SELECT 3; |
grep -oP '\d{2}:\d{2}:\d{2}\.\d{6}' ./var/mysqld.1/data/bug.log |
Shows that the %f idiom (microseconds) always renders as 000000. And,
SELECT DATE_FORMAT(NOW(6), '%H:%i:%s.%f'); |
Shows that microsecond resolution time is available. Finally, from:
INSTALL PLUGIN server_audit SONAME 'server_audit'; |
SELECT * FROM information_schema.system_variables WHERE variable_name='SERVER_AUDIT_TIMESTAMP_FORMAT'\G |
We read:
|
CS 13.0.0 c5f6fd3e7c8a430f8d27a505bb8d2ae00f6396a6 (Optimized, Clang 21.1.3-20250923) Build 23/03/2026 |
VARIABLE_COMMENT: A format string used to print the timestamp into the audit log messages The format used is the same as DATE_FORMAT
|
As such, %f should work.
The fix is perhaps as simple as swapping time() with my_hrtime().
When fixing this bug please also fix the minor cosmetic info string typo: There should be a ". " after "messages".
At the moment there is only a space (iow, "." needs to be added after "messages" and before the space).
Attachments
Issue Links
- is caused by
-
MDEV-18386 Allow audit plugin to specify timestamp format when writing to file
-
- Closed
-