How to view mariadb log

log-filesloggingmariadb

I am using new relic to monitor the performance of my server. Recently I noticed a very strange problem where for every 3 hours, the server will be down for 1 minute. And in the new relic report, during the server down time, there were sudden spike on the database.

The problem is I am new in system admin, I don't know how to view the database log. I am using Mariadb on a Ubuntu 14.04 machine. So, where can I find the log?
I tried to view in /var/log/mysql.err, /var/log/mysql.log and /var/log/mysql/error.log there are no content inside.

I also tried grep 'mysql' /var/log/syslog, nothing found as well.

Do I need to enable the logging in mariadb config file? If so, how?

Best Answer

One of the ways to find out your current log file path is using the following SQL query:

show global variables like 'log_error';

The output should look something like this:

+---------------+---------------------+
| Variable_name | Value               |
+---------------+---------------------+
| log_error     | /var/log/mysqld.log |
+---------------+---------------------+
Related Topic