The MySQL Enterprise Audit plugin enables MySQL Server to produce a log file
containing an audit record of server activity. The log content includes when clients connect
and disconnect, and what actions they perform while connected, such as which databases and
tables they access.
You can add statistics for the time and size of each query to detect outliers. By
default, audit plugin logs are disabled, and you have to define audit plugin filters to
enable logging auditable events for all or specific users.
By default, the HeatWave administrator user you defined while creating the DB system has the AUDIT_ADMIN privilege. You can grant audit administration privileges to more users.
Using a Command-Line Client 🔗
Use a command-line client such as MySQL Client or MySQL Shell to grant audit
administration privileges to more users.
Connect to the DB system using the command-line client of your
choice.
Run the following command to grant the user, User001, the
audit administration privilege:
You have to define audit plugin filters to enable logging auditable events
for all or specific users. By default, audit plugin logs are disabled.
Using a Command-Line Client 🔗
Use a command-line client such as MySQL Client or MySQL Shell to define audit
plugin filters to enable logging auditable events for all or specific users.
This task requires the following:
MySQL version 8.0.34-u2 or higher.
Connect to the DB system using the command-line client of your
choice.
Use a command-line client such as MySQL Client or MySQL Shell to access and
analyze audit data.
Connect to the DB system using the command-line client of your
choice.
To view any new logs since you last checked, run the following command. This
ensures you are always updated with the latest audit logs without revisiting
older logs.
SELECT audit_log_read(audit_log_read_bookmark());
To extract audit logs starting from a particular timestamp, provide additional
parameters within the audit_log_read() function:
To view the audit data in an easier to read format, use the
JSON_PRETTY() and CONVERT()
functions:
SELECT JSON_PRETTY(CONVERT(audit_log_read( ... ) USING UTF8MB4));
To transform data to tabular format, use the MySQL JSON functions. For example,
you can transform a subset of the JSON name-value pairs into a structured table
format, making it easier to interact with and analyze data: