Uploaded image for project: 'Percona Server for MySQL'
  1. Percona Server for MySQL
  2. PS-1116

LP #1719506: Audit plugin reports "command_class=error" for server-side prepared statements

Details

    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

          Activity

            People

              nitendra.bhosle Nitendra Bhosle (Inactive)
              lpjirasync lpjirasync (Inactive)
              Votes:
              4 Vote for this issue
              Watchers:
              11 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0 minutes
                  0m
                  Logged:
                  Time Spent - 1 week, 6 hours
                  1w 6h

                  Smart Checklist