Is there a way to mark up or tag mysql transactions for logging?

I'm looking at switching on logging for mysql as a form of auditing. I already log all interactions with my database in an external log but, as newer versions are developed, these transactions are likely to change.

I'm aware that I can group my queries together with

START TRANSACTION
...
BEGIN
...
COMMIT

Is there a way to "mark up", tag, or add a comment that ends up in the log that can provide meta-information about the transaction?

e.g.

START TRANSACTION //By [user] in [function()], [product], version [XX.YY]
...
BEGIN
...
COMMIT

Upvotes: 0

Views: 134

Answers (1)

georgexsh
georgexsh

Reputation: 16624

SQL supports comments, however, by default MySQL don't write comments to its log, you could either use statement-based binlogs, or enable binlog_rows_query_log_events option, this option is available since 5.7.

Upvotes: 1

Related Questions