Skip to content

Collecting Mysql-data

Edit mysql config file

nano /etc/mysql/my.cnf

Add the following lines below [mysqld]

plugin_load=server_audit=server_audit.so
server_audit_events=connect,query,table
server_audit=FORCE_PLUS_PERMANENT

restart mysql service with command: systemctl restart mysql.service** OR **service mysql restart

The default location for the logs is : /var/lib/mysql/server_audit.log

If syslog logging is required add the following parameter to /etc/mysql/my.cnf below [mysqld]

server_audit_output_type=SYSLOG

restart mysql service with command: systemctl restart mysql.service OR service mysql restart

Check parameters with the following command: SHOW GLOBAL VARIABLES LIKE 'server_audit%';

Alt text

Check syslog logging with the following command: tail -f /var/log/syslog OR tail -f /var/log/messages

Reference https://mariadb.com/kb/en/library/mariadb-audit-plugin-installation/