The general query log is a log of every SQL query received from a client, as well as each client connect and disconnect.

Activating the General Query Log

The general query log is disabled by default. Since it's a record of every query received by the server, it can grow large quite quickly. If you only want a record of queries that change data, rather use thebinary log instead.

To activate the general query log, set the general_log system variable to 1. The log_output server status variable determines how the output will be written, and can also disable it (see Writing logs into tables for details). If written to file, the name of the file is determined by the --general_log_file=file_name option, by default host_name.log, while the directory will be the data directory unless an absolute path is specified.

Unlike the binary log, the query log records queries in the same order that the server receives them, and not necessarily the same order that they are executed.

Example of how to log to file

By adding this to your my.cnf file all queries will be logged to the file queries.log in the datadir directory.

[[mysqld]]
general-log
general-log-file=queries.log
log-output=file

Another option is to use the log-basename (see mysqld replication options) option which ensures that all your log files (general log, replication logs etc) start with a common unique prefix. The following example will create a system.log log file.

[[mysqld]]
general-log
log-output=file
log-basename=system



source - https://mariadb.com/kb/en/mariadb/general-query-log/


'DB > MariaDB' 카테고리의 다른 글

mariadb - install  (0) 2014.07.20
Posted by linuxism
,