Details
-
Bug
-
Status: Done
-
High
-
Resolution: Fixed
-
5.5.57-38.9, 5.6.x, 5.7.x, 8.0.x
-
None
Description
**Reported in Launchpad by Andrew Garner last update 05-10-2017 03:12:43
When logging a prepared statement through the prepared statement api, the command class is logged as "error" even for successful executions.
Here is an example snippet from logs where a successful "SHOW GLOBAL VARIABLES WHERE Variable_name = ?", "max_allowed_packet" is executed:
{"audit_record":{"name":"Prepare","record":"132355_2017-09-26T04:31:44","timestamp":"2017-09-26T04:31:57 UTC","command_class":"error","connection_id":"4","status":0,"sqltext":"","user":"root[root] @ [127.0.0.1]","host":"","os_user":"","ip":"127.0.0.1","db":""}}
{"audit_record":{"name":"Execute","record":"132356_2017-09-26T04:31:44","timestamp":"2017-09-26T04:31:57 UTC","command_class":"error","connection_id":"4","status":0,"sqltext":"SHOW GLOBAL VARIABLES WHERE Variable_name = 'max_allowed_packet'","user":"root[root] @ [127.0.0.1]","host":"","os_user":"","ip":"127.0.0.1","db":""}}
{"audit_record":{"name":"Close stmt","record":"132357_2017-09-26T04:31:44","timestamp":"2017-09-26T04:31:57 UTC","command_class":"error","connection_id":"4","status":0,"sqltext":"","user":"root[root] @ [127.0.0.1]","host":"","os_user":"","ip":"127.0.0.1","db":""}}
This seems to be due to the audit api setting general_sql_command based on sql_statement_names, where there's no matching entry for the current binary protocol command.
This is confusing for users consuming these logs who might be using server-side prepared statements.
Attachments
Issue Links
- is duplicated by
-
PS-3530 LP #1617227: audit log doesn't record everything
-
- Done
-