Product Solutions Support
Try MemSQL

Trace Log

MemSQL uses a consolidated general/error log, referred to as the tracelog, to report INFO, WARNING, ERROR, and FAILURE messages.

Location and Management

The tracelog is located in the memsqlbin/tracelogs directory with the file name memsql.log. When the server is started, it opens this file in append mode and begins to log messages.

You can rotate the log by moving the memsql.log file and then sending SIGHUP to the memsqld process. This will trigger the server to reopen memsql.log and continue writing.

MemSQL manages code compilation with a separate process. This process also maintains a tracelog named command.log.

Use the logrotate utility combined with a configuration file to automatically manage MemSQL log rotation. An example is shown below:

cat > /var/tmp/logrotate.conf <<EOF
/path/to/master-3306/tracelogs/command.log /path/to/master-3306/tracelogs/command.log {
         rotate 7
             # Send SIGHUP to both memsqld processes
             killall -q -s1 memsqld

 # run logrotate command
 logrotate -f /var/tmp/logrotate.conf

 # show contents of directory
 ls /var/lib/memsql/master-3306/tracelogs/*.gz

Logging Queries

MemSQL supports logging queries by adjusting the general_log variable, which has the filename queries.log. These queries are logged in the tracelog. The general_log variable supports three values:

  • OFF (default). No queries are logged.
  • PARTIAL. Logs a sample of the queries running through the system. This mode is designed for minimal overhead: if multiple queries are trying to write to the query log simultaneously, only one will succeed and the other writes will be abandoned.
  • ON. Every query running through the system is logged. This mode has a significantly negative impact on performance as query execution now depends on writes to the tracelog.

The value may be adjusted using the following command:

memsql> SET GLOBAL general_log='PARTIAL'

Related Topics

Was this article useful?