[PS 8.4.4] Audit component doesn't work as expected

Description:

Hi ! Has anyone tried the auditing component of Percona Server 8.4.4? The output format is not the same as that described in the documentation and makes the logs very difficult to use.

I don’t know if this was the right place to report the bug but I did it here: Percona Server for MySQL - Issues - Percona JIRA
If anyone can tell me if it’s because I’m doing something wrong, I’m interested!

I can’t have the who / when / where / what information in the same event.

Steps to Reproduce:

Deploy the component and create a filter.

Version:

8.4.4

Logs:

For a SELECT 1; query with a filter that logs everything ( “filter”: { “log”: true }):

[
  {
    "timestamp": "2025-05-05 16:21:42",
    "id": 0,
    "class": "audit",
    "event": "audit",
    "server_id": 104572723
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 1,
    "class": "connection",
    "event": "connect",
    "connection_id": 91,
    "account": { "user": "valentin.traen", "host": "localhost" },
    "login": { "user": "valentin.traen", "os": "", "ip": "", "proxy": "''@''" },
    "connection_data": {
      "connection_type": "socket",
      "status": 0,
      "db": ""
    },
    "connection_attributes": {
      "_pid": "937322",
      "_platform": "x86_64",
      "_os": "Linux",
      "_client_name": "libmysql",
      "os_user": "valentin.traen",
      "_client_version": "8.4.4-4",
      "program_name": "mysql"
    }
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 2,
    "class": "command",
    "event": "command_start",
    "connection_id": 91,
    "command_data": {
      "name": "command_start",
      "status": 0,
      "command": "Query"}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 3,
    "class": "parse",
    "event": "query_rewritten",
    "connection_id": 91,
    "parse_data": {
      "flags": 0,
      "query": "select @@version_comment limit 1",
      "rewritten_query": ""}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 4,
    "class": "parse",
    "event": "prepared_statement",
    "connection_id": 91,
    "parse_data": {
      "flags": 0,
      "query": "select @@version_comment limit 1",
      "rewritten_query": ""}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 5,
    "class": "general",
    "event": "log",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 6,
    "class": "query",
    "event": "query_start",
    "connection_id": 91,
    "query_data": {
      "query": "select @@version_comment limit 1",
      "status": 0,
      "sql_command": "select"}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 7,
    "class": "global_variable",
    "event": "variable_get",
    "connection_id": 91,
    "global_variable_data": {
      "name": "version_comment",
      "value": "Percona Server (GPL), Release '4', Revision '844fde07'",
      "sql_command": "select"}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 8,
    "class": "query",
    "event": "query_status_end",
    "connection_id": 91,
    "query_data": {
      "query": "select @@version_comment limit 1",
      "status": 0,
      "sql_command": "select"}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 9,
    "class": "general",
    "event": "result",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 10,
    "class": "general",
    "event": "status",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 11,
    "class": "command",
    "event": "command_end",
    "connection_id": 91,
    "command_data": {
      "name": "command_end",
      "status": 0,
      "command": "Query"}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 12,
    "class": "command",
    "event": "command_start",
    "connection_id": 91,
    "command_data": {
      "name": "command_start",
      "status": 0,
      "command": "Query"}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 13,
    "class": "parse",
    "event": "query_rewritten",
    "connection_id": 91,
    "parse_data": {
      "flags": 0,
      "query": "select $$",
      "rewritten_query": ""}
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 14,
    "class": "general",
    "event": "error",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 1064 }
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 15,
    "class": "general",
    "event": "status",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 1064 }
  },
  {
    "timestamp": "2025-05-05 16:21:50",
    "id": 16,
    "class": "command",
    "event": "command_end",
    "connection_id": 91,
    "command_data": {
      "name": "command_end",
      "status": 1064,
      "command": "Query"}
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 17,
    "class": "command",
    "event": "command_start",
    "connection_id": 91,
    "command_data": {
      "name": "command_start",
      "status": 0,
      "command": "Query"}
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 18,
    "class": "parse",
    "event": "query_rewritten",
    "connection_id": 91,
    "parse_data": {
      "flags": 0,
      "query": "SELECT 1",
      "rewritten_query": ""}
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 19,
    "class": "parse",
    "event": "prepared_statement",
    "connection_id": 91,
    "parse_data": {
      "flags": 0,
      "query": "SELECT 1",
      "rewritten_query": ""}
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 20,
    "class": "general",
    "event": "log",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 21,
    "class": "query",
    "event": "query_start",
    "connection_id": 91,
    "query_data": {
      "query": "SELECT 1",
      "status": 0,
      "sql_command": "select"}
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 22,
    "class": "query",
    "event": "query_status_end",
    "connection_id": 91,
    "query_data": {
      "query": "SELECT 1",
      "status": 0,
      "sql_command": "select"}
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 23,
    "class": "general",
    "event": "result",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 24,
    "class": "general",
    "event": "status",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:53",
    "id": 25,
    "class": "command",
    "event": "command_end",
    "connection_id": 91,
    "command_data": {
      "name": "command_end",
      "status": 0,
      "command": "Query"}
  },
  {
    "timestamp": "2025-05-05 16:21:55",
    "id": 26,
    "class": "command",
    "event": "command_start",
    "connection_id": 91,
    "command_data": {
      "name": "command_start",
      "status": 0,
      "command": "Quit"}
  },
  {
    "timestamp": "2025-05-05 16:21:55",
    "id": 27,
    "class": "general",
    "event": "log",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:55",
    "id": 28,
    "class": "general",
    "event": "result",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:55",
    "id": 29,
    "class": "general",
    "event": "status",
    "connection_id": 91,
    "account": { "user": "ldap_group[valentin.traen] @ localhost []", "host": "localhost" },
    "login": { "user": "ldap_group[valentin.traen] @ localhost []", "ip": "", "proxy": "" },
    "general_data": { "status": 0 }
  },
  {
    "timestamp": "2025-05-05 16:21:55",
    "id": 30,
    "class": "command",
    "event": "command_end",
    "connection_id": 91,
    "command_data": {
      "name": "command_end",
      "status": 0,
      "command": "Quit"}
  },
  {
    "timestamp": "2025-05-05 16:21:55",
    "id": 31,
    "class": "connection",
    "event": "disconnect",
    "connection_id": 91,
    "account": { "user": "valentin.traen", "host": "localhost" },
    "login": { "user": "valentin.traen", "os": "", "ip": "", "proxy": "''@''" },
    "connection_data": {
      "connection_type": "socket",
      "status": 0,
      "db": ""
    },
    "connection_attributes": {
      "_pid": "937322",
      "_platform": "x86_64",
      "_os": "Linux",
      "_client_name": "libmysql",
      "os_user": "valentin.traen",
      "_client_version": "8.4.4-4",
      "program_name": "mysql"
    }
  }
]

Expected Result:

What I don’t understand is that according to the documentation, I should have the who / what / when / where at the level of each event. That was the result with the module in PS 8.0.

From the doc :

{
    "timestamp": "2023-03-29 11:17:05",
    "id": 2,
    "class": "general",
    "event": "log",
    "connection_id": 11,
    "account": { "user": "root[root] @ localhost []", "host": "localhost" },
    "login": { "user": "root[root] @ localhost []", "os": "", "ip": "", "proxy": "" },
    "general_data": {
      "command": "Query",
      "sql_command": "create_table",
      "query": "CREATE TABLE t1 (c1 INT)",
      "status": 0}
  }

Actual Result:

I tried lots of filters but each time I don’t have an event containing the who / what / when / where on the same line.
Each time I have a connection event with the associated connection id, then the request with the same associated id but in different events. As it is not a database with foreign keys but a json file, it is very hard to exploit.