I have next settings:
SELECT audit_log_filter_set_filter('only_logins', '{"filter": {"class": [{"name": "connection", "event": [{"name": "connect"}, {"name": "disconnect"}]}]}}');
SELECT audit_log_filter_set_user('%', 'only_logins');
And what I get on every connection/disconnection:
{
"timestamp": "2026-08-19 11:14:26",
"id": 14487,
"class": "connection",
"event": "connect",
"connection_id": 4955,
"account": { "user": "root", "host": "localhost" },
"login": { "user": "root", "os": "", "ip": "", "proxy": "" },
"connection_data": {
"connection_type": "socket",
"status": 0,
"db": "",
"connection_attributes": {
"_pid": "3253441",
"_platform": "x86_64",
"_os": "Linux",
"_client_name": "libmysql",
"os_user": "root",
"_client_version": "8.4.10-10",
"program_name": "mysql"
}
}
},
{
"timestamp": "2026-08-19 11:14:26",
"id": 14488,
"class": "connection",
"event": "disconnect",
"connection_id": 4955,
"account": { "user": "root", "host": "localhost" },
"login": { "user": "root", "os": "", "ip": "", "proxy": "" },
"connection_data": {
"connection_type": "socket"
}
},
{
"timestamp": "2026-08-19 11:14:26",
"id": 14489,
"class": "connection",
"event": "disconnect",
"connection_id": 4955,
"account": { "user": "root", "host": "localhost" },
"login": { "user": "root", "os": "", "ip": "", "proxy": "" },
"connection_data": {
"connection_type": "socket"
}
}
it does not depend how I connect to a server via socket or tcp.
Could you help me to create audit filter only for connection/disconnection?
Thank you.