An introductory guide to the various logs available in MariaDB, including the Error Log, General Query Log, Slow Query Log, and Binary Log, and how to enable or disable them.
There are many variables in MariaDB that you can use to define what to log and when to log.
This article will give you an overview of the different logs and how to enable/disable logging to these.
Note that storage engines can have their logs too: for example, InnoDB keeps an Undo Log and a Redo Log which are used for rollback and crash recovery. However, this page only lists MariaDB server logs.
Always enabled
Usually a file in the data directory, but some distributions may move this to other locations.
All critical errors are logged here.
One can get warnings to be logged by setting .
With the --syslog option one can duplicate the messages to the system's syslog.
Enabled with
Logs all queries to a .
Useful for debugging or auditing queries.
The super user can disable logging to it for a connection by setting to 1.
Enabled by starting mysqld with
Logs all queries to a .
Useful to find queries that causes performance problems.
Logs all queries that takes more than to run.
Enabled by starting mysqld with
Used on machines that are, or may become, replication masters.
Required for point-in-time recovery.
Binary log files are mainly used by replication and can also be used with to apply on a backup to get the database up to date.
If you know that your next query will be slow and you don't want to log it in the slow query log, do:
If you are a super user running a log batch job that you don't want to have logged (for example mariadb-dump), do:
(previously mysqldump) since will add this automatically to your dump file if you run it with the --skip-log-queries option.
This page is licensed: CC BY-SA / Gnu FDL
One can decide what to log with the options --log-slow-admin-statements, --log-slow-slave-statements, log_slow_filter or log_slow_rate_limit.
One can change what is logged by setting log_slow_verbosity.
One can disable it globally by setting global.slow_query_log to 0
In 10.1 one can disable it for a connection by setting local.slow_query_log to 0.
One can decide what to log with --binlog-ignore-db=database_name or --binlog-do-db=database_name.
The super user can disable logging for a connection by setting SQL_LOG_BIN to 0. However while this is 0, no changes done in this connection will be replicated to the slaves!
For examples, see Using and Maintaining the Binary Log.
SET LOCAL SLOW_QUERY_LOG=0;SET LOCAL SQL_LOG_OFF=1, LOCAL SLOW_QUERY_LOG=0;