Description\n-----------\n\nThere are a several options and system variables related to the MariaDB Audit Plugin, once it has been installed. System variables can be displayed using the SHOW VARIABLES statement like so:\n\n``sql\nSHOW GLOBAL VARIABLES LIKE 'server_audit%';\n+-------------------------------+-----------------------+\n| Variable_name                 | Value                 |\n+-------------------------------+-----------------------+\n| server_audit_events           |                       |\n| server_audit_excl_users       |                       |\n| server_audit_file_buffer_size | 0                     |\n| ...                           | ...                   |\n| server_audit_syslog_priority  | LOG_INFO              |\n| server_audit_timestamp_format | %Y%m%d %H:%i:%s       |\n+-------------------------------+-----------------------+\n`\n\nTo change the value of one of these variables, you can use the SET statement, or set them at the command-line when starting MariaDB. It's recommended that you set them in the MariaDB configuration for the server like so:\n\n`ini\n[mariadb]\n...\nserver_audit_excl_users='bob,ted'\n...\n`\n\nSystem Variables\n\nBelow is a list of all system variables related to the Audit Plugin. See Server System Variables for a complete list of system variables and instructions on setting them. See also the full list of MariaDB options, system and status variables.\n\nserver_audit_events\n\n Description: If set, this restricts audit logging to certain event types. If not set, every event type is logged to the audit log.\n Command line: --server-audit-events=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: Empty string\n Valid values:\n   CONNECT, QUERY, TABLE (MariaDB Audit Plugin < 1.2.0)\n   CONNECT, QUERY, TABLE, QUERY_DDL, QUERY_DML (MariaDB Audit Plugin >= 1.2.0)\n   CONNECT, QUERY, TABLE, QUERY_DDL, QUERY_DML, QUERY_DCL (MariaDB Audit Plugin >=1.3.0)\n   CONNECT, QUERY, TABLE, QUERY_DDL, QUERY_DML, QUERY_DCL, QUERY_DML_NO_SELECT (MariaDB Audit Plugin >= 1.4.4)\n   Consult MariaDB Audit Plugin - Versions for a list of MariaDB releases and their corresponding Audit Plugin versions.\n\nserver_audit_excl_users\n\n Description: If not empty, it contains the list of users whose activity will NOT be logged: SET GLOBAL server_audit_excl_users='user_foo, user_bar'. CONNECT records aren't affected by this variable - they are always logged. The user is still logged if it's specified in server_audit_incl_users.\n Command line: --server-audit-excl-users=_value_\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: Empty string\n Size limit: 1024 characters\n\nserver_audit_file_buffer_size\n\n Description: Size (in bytes) of file buffer to make logging faster. Values > 0 are adjusted in increments of 8192. (For instance, a value of 100 would be adjusted to 8192.)\n Command line: --server-audit-file-buffer-size=_#_\n Scope: Global\n Dynamic: Yes\n Data type: numeric\n Value range: 0 to 65536\n Default value: 0 (no buffering)\n Introduced: MariaDB 12.1\n Usage: See description\n\nserver_audit_file_path\n\n Description: When server_audit_output_type=file, sets the path and the filename to the log file. If the specified path exists as a directory, then the log will be created inside that directory with the name 'server_audit.log'. Otherwise the value is treated as a filename. The default value is 'server_audit.log', which means this file will be created in the database directory.\n Command line: --server-audit-file-path=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: server_audit.log\n\nserver_audit_file_rotate_now\n\n Description: When server_audit_output_type=file, the user can force the log file rotation by setting this variable to ON or 1.\n Command line: --server-audit-rotate-now[={0|1}]\n Scope: Global\n Dynamic: Yes\n Data type: boolean\n Default value: OFF\n\nserver_audit_file_rotate_size\n\n Description: When server_audit_output_type=file, it limits the size of the log file to the given amount of bytes. Reaching that limit turns on the rotation - the current log file is renamed as 'file_path.1'. The empty log file is created as 'file_path' to log into it. The default value is 1000000.\n Command line: --server-audit-rotate-size=#\n Scope: Global\n Dynamic: Yes\n Data Type: numeric\n Default Value: 1000000\n Range: 100 to 9223372036854775807\n\nserver_audit_file_rotations\n\n Description: When server_audit_output_type=file', this specifies the number of rotations to save. If set to 0 then the log never rotates. The default value is 9.\n Command line: --server-audit-rotations=#\n Scope: Global\n Dynamic: Yes\n Data type: numeric\n Default value: 9\n Range: 0 to 999\n\nserver_audit_incl_users\n\n Description: If not empty, it contains a comma-delimited list of users whose activity will be logged: SET GLOBAL server_audit_incl_users='user_foo, user_bar'. CONNECT records aren't affected by this variable - they are always logged. This setting has higher priority than server_audit_excl_users. So if the same user is specified both in incl_ and excl_ lists, they will still be logged.\n Command line: --server-audit-incl-users=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: Empty string\n Size limit: 1024 characters\n\nserver_audit_loc_info\n\n Description: Used by plugin internals. It has no useful meaning to users.\n   In earlier versions, users see it as a read-only variable.\n   In later versions, it is hidden from the user.\n Command line: N/A\n Scope: Global\n Dynamic: No\n Data Type: string\n Default Value: Empty string\n\nserver_audit_logging\n\n Description: Enables/disables the logging. Expected values are ON/OFF: SET GLOBAL server_audit_logging=on If the server_audit_output_type is FILE, this will actually create/open the logfile so the server_audit_file_path should be properly specified beforehand. Same about the SYSLOG-related parameters. The logging is turned off by default.\n Command line: --server-audit-logging[={0|1}]\n Scope: Global\n Dynamic: Yes\n Data type: boolean\n Default value: OFF\n\nserver_audit_mode\n\n Description: This variable doesn't have any distinctive meaning for a user. Its value mostly reflects the server version with which the plugin was started and is intended to be used by developers for testing.\n Command line: --server-audit-mode[=#]\n Scope: Global\n Dynamic: Yes\n Data type: numeric\n Default value: 0\n Range: 0 to 1\n\nserver_audit_output_type\n\n Description: Specifies the desired output type. Can be SYSLOG, FILE or null as no output: SET GLOBAL server_audit_output_type=file file: log records will be saved into the rotating log file. The name of the file set by server_audit_file_path variable. syslog: log records will be sent to the local syslogd daemon with the standard \\<syslog.h> API. The default value is 'file'.\n Command line: --server-audit-output-type=value\n Scope: Global\n Dynamic: Yes\n Data type: enum\n Default value: file\n Valid values: SYSLOG, FILE\n\nserver_audit_query_log_limit\n\n Description: Limit on the length of the query string in a record.\n Command line: --server-audit-query-log-limit=#\n Scope: Global\n Dynamic: Yes\n Data type: numeric\n Default value: 1024\n Range: 0 to 2147483647\n\nserver_audit_sync_log_file\n\n Description: Flushes the buffer to the log file.\\\n  While log records are in the buffer, they don't appear in the log file. To write them out from the buffer, issue this statement:\\\n  SET GLOBAL server_audit_sync_log_file=1\n Command line: --server-audit-sync-log-file\n Scope: Global\n Dynamic: Yes\n Data type: N/A\n Default value: OFF\n Valid values: ON (or 1), OFF (or 0)\n Introduced: MariaDB 12.1\n Usage: See description\n\nserver_audit_syslog_facility\n\n Description: SYSLOG-mode variable. It defines the 'facility' of the records that will be sent to the syslog. Later the log can be filtered by this parameter.\n Command line: --server-audit-syslog-facility=value\n Scope: Global\n Dynamic: Yes\n Data type: enum\n Default value: LOG_USER\n Valid values: LOG_USER, LOG_MAIL, LOG_DAEMON, LOG_AUTH, LOG_SYSLOG, LOG_LPR, LOG_NEWS, LOG_UUCP, LOG_CRON, LOG_AUTHPRIV, LOG_FTP, and LOG_LOCAL0–LOG_LOCAL7.\n\nserver_audit_syslog_ident\n\n Description: SYSLOG-mode variable. String value for the 'ident' part of each syslog record. Default value is 'mysql-server_auditing'. New value becomes effective only after restarting the logging.\n Command line: --server-audit-syslog-ident=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: mysql-server_auditing\n\nserver_audit_syslog_info\n\n Description: SYSLOG-mode variable. The 'info' string to be added to the syslog records. Can be changed any time.\n Command line: --server-audit-syslog-info=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: Empty string\n\nserver_audit_syslog_priority\n\n Description: SYSLOG-mode variable. Defines the priority of the log records for the syslogd.\n Command line: --server-audit-syslog-priority=value\n Scope: Global\n Dynamic: Yes\n Data type: enum\n Default value: LOG_INFO\n Valid values:LOG_EMERG, LOG_ALERT, LOG_CRIT, LOG_ERR, LOG_WARNING, LOG_NOTICE, LOG_INFO, LOG_DEBUG\n\nserver_audit_timestamp_format\n\n Description: A format string used to print the timestamp into the audit log messages. The format used is the same as DATE_FORMAT.\n Command line: --server-audit-timestamp-format=value\n Scope: Global\n Dynamic: Yes\n Data type: string\n Default value: %Y%m%d %H:%i:%s\n\nNotes on System Variables\n\naudit_file_buffer_size and server_audit_sync_log_file\n\nThe server audit plugin typically employs synchronous, per-event logging, causing performance bottlenecks. Individual file writes for each log entry can result in significant I/O overhead, especially in large database environments. As of MariaDB 12.1, two new variables were introduced to allow asynchronous logging, and more fine grained control over how audit log writes are handled. Using the server_audit_file_buffer_size setting (buffer size in bytes), you can configure an additional in-memory audit log buffer. When the size of the buffer exceeds the server_audit_file_buffer_size setting, the audit log is written to disk. Additionally, a manual on-demand audit log disk sync can be triggered by setting server_audit_sync_log_file to ON or 1.\n\nOptions\n\nserver_audit\n\n Description: Controls how the server should treat the plugin when the server starts up.\n   Valid values are:\n     OFF - Disables the plugin without removing it from the mysql.plugins table.\n     ON - Enables the plugin. If the plugin cannot be initialized, then the server will still continue starting up, but the plugin will be disabled.\n     FORCE - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error.\n     FORCE_PLUS_PERMANENT - Enables the plugin. If the plugin cannot be initialized, then the server will fail to start with an error. In addition, the plugin cannot be uninstalled with UNINSTALL SONAME or UNINSTALL PLUGIN while the server is running.\n   See MariaDB Audit Plugin - Installation: Prohibiting Uninstallation for more information.\n   See Plugin Overview: Configuring Plugin Activation at Server Startup for more information.\n Command line: --server-audit=val\n Data Type: enumerated\n Default Value: ON\n* Valid Values: OFF, ON, FORCE, FORCE_PLUS_PERMANENT`\n\nURL: https://mariadb.com/docs/server/reference/plugins/mariadb-audit-plugin/mariadb-audit-plugin-options-and-system-variables