Audit plugin reports "command_class=error" for server-side prepared statements
Affects | Status | Importance | Assigned to | Milestone | ||
---|---|---|---|---|---|---|
Percona Server moved to https://jira.percona.com/projects/PS | Status tracked in 5.7 | |||||
5.5 |
Triaged
|
High
|
Unassigned | |||
5.6 |
Triaged
|
High
|
Unassigned | |||
5.7 |
Triaged
|
High
|
Unassigned |
Bug Description
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_
{"audit_
{"audit_
{"audit_
This seems to be due to the audit api setting general_sql_command based on sql_statement_
This is confusing for users consuming these logs who might be using server-side prepared statements.
summary: |
- Audit plugin reports "error" for prepared queries issued through binary - protocol + Audit plugin reports "error" for server-side prepared statements |
summary: |
- Audit plugin reports "error" for server-side prepared statements + Audit plugin reports "command_class=error" for server-side prepared + statements |
tags: | added: audit |
5.5.57-38.9, 5.6.37-82.2, 5.7.19-17 EMPTY_PASSWORD= 1 --name p55 percona:5.5 mysql.connector .connect( database= 'information_ schema' , user='root') prepared= True) execute( stmt, ("max_allowed_ packet" ,))
docker run --rm -it -e MYSQL_ALLOW_
apt-get update ; apt-get install -y python3-
mysql -e "INSTALL PLUGIN audit_log SONAME 'audit_log.so';"
python3 << 'EOF'
import mysql.connector
cnx = mysql.connector
cursor = cnx.cursor(
stmt = "SHOW GLOBAL VARIABLES WHERE Variable_name = ?"
cursor.
cursor.fetchall()
cursor.close()
cnx.close()
EOF
In addition to prepared statements command class is error for Ping: "7_2017- 10-04T04: 45:30" "2017-10- 04T04:47: 37 UTC" CLASS=" error"
<AUDIT_RECORD
NAME="Ping"
RECORD=
TIMESTAMP=
COMMAND_
CONNECTION_ID="2"
STATUS="0"
SQLTEXT=""
USER="root[root] @ [127.0.0.1]"
HOST=""
OS_USER=""
IP="127.0.0.1"
/>
Andrew, please provide information about your mysql client library (what programming language you are using?)