Search code examples
mysqldatabasetimestamptimestamp-with-timezonesql-timestamp

MySQL 5.1.73 Change timestamp format for general_log file


I'm trying to change the format of the general log file generated by MySQL 5.1.73.

the actual timestamp format for "event_time is:

"210909 10:32:12 12 Connect user@localhost on database"

Is there a possibility for changing its timestamp format ?

I would like the format to follow the format: 2015-04-14 22:52:11 or even containing the timezone following the RFC 3339. "1937-01-01T12:00:27.87+00:2" (UTC)


Solution

  • I found a solution by adding the mysql-general.log file as inputFile in rsyslog. Applying a template allow me to rewrite the log with a correct timestamp format.

    Thanks for your replies / comments