Read Audit log in MySQL

SELECT @@server_uuid as server_uuid, ts, class, event, login_ip,login_user,connection_id,
status,connection_type,_client_name,_client_version,
command,sql_command,command_status
FROM
JSON_TABLE
(
AUDIT_LOG_READ( '{ "start": {\"timestamp\": \"2023-08-16 15:33:37\"}, \"max_array_length\": 500 }' ),
'$[*]'
COLUMNS
(
ts TIMESTAMP PATH '$.timestamp',
class VARCHAR(20) PATH '$.class',
event VARCHAR(80) PATH '$.event',
login_ip VARCHAR(200) PATH '$.login.ip',
login_user VARCHAR(200) PATH '$.login.user',
connection_id VARCHAR(80) PATH '$.connection_id',
status INT PATH '$.connection_data.status',
connection_type VARCHAR(40) PATH '$.connection_data.connection_type',
_client_name VARCHAR(80) PATH '$.connection_data.connection_attributes._client_name',
_client_version VARCHAR(80) PATH '$.connection_data.connection_attributes._client_version',
command VARCHAR(40) PATH '$.general_data.command',
sql_command VARCHAR(40) PATH '$.general_data.sql_command',
command_status VARCHAR(40) PATH '$.general_data.status'
)) as audit_log;

Leave a Reply

Your email address will not be published. Required fields are marked *