Percona Audit log issue with update cammand_class

I am using percona audit log plugin with Oracle MySQL 8.0.23 earlier is was working fine.
From last week it is not able to log any update query.

Any suggestions.
Thank you in Advance.

Hi @lokesh123

First of all, let me clarify that we do not guarantee compatibility between audit_plugin and Oracle MySQL, if it works, it’s by chance and not by design.
The plugin itself its build into two parts, the server part (which our changes go only to Percona Server) and the plugin part (the .so you copy and drop to Oracle MySQL plugin library). As you can imagine, changes to the server part won’t be compatible between PS and MySQL.

That said, check if your .so is from Percona Server 8.0.25, if so we added a fix for Prepared Statements command_class that is most likely causing what you are seeing. For reference [PS-1116] LP #1719506: Audit plugin reports "command_class=error" for server-side prepared statements - Percona JIRA

2 Likes

Hi @Marcelo_Altmann
Thank you For the suggestion.

1 Like

Hi @Marcelo_Altmann,

I have found in update query command class return as ‘ERROR’. But the query is success.
Can you help in this?

e.g.

{“audit_record”:{“name”:“Execute”,“record”:“1057_2021-08-09T10:32:57”,“timestamp”:“2021-08-09T10:42:12Z”,“command_class”:“error”,“connection_id”:“43”,“status”:0,“sqltext”:“UPDATE ab.lock SET Code = ‘1235’ WHERE (ID = ‘1234’)”,“user”:“lokesh[lokesh] @ [localhost]”,“host”:“”,“os_user”:“”,“ip”:“localhost”,“db”:“”}}

2 Likes

Hi @lokesh123 ,

See you have “name”:“Execute” this means you are executing Prepare Statement. It will always show as an error prior to 8.0.25, after that, on Percona Server MySQL you should see the corresponding command class on it.

2 Likes

@Marcelo_Altmann

I have tested then realized that when the query executed with workbench editor it sent query as Prepare statement and auditlog take it always an error but when execute from command prompt it show class as ‘update’. Some how I handle it with script which replace error with relevant class.

1 Like

Right, just bare in mind that and execute commnad of a Prepared Statement can fail, by blindly replacing the command_class error you will be by-passing the real outcome of your EXECUTE.

2 Likes

Yes I kept that as well for that I am just checking the status column should be ''0" for replacing the command_class for error.

2 Likes