Sorry if this is a wrong place to ask.
I use Ubuntu 16.04, with very little knowledge of linux system, I depend on webmin to host my website. Recently there has been a problem where mysql won't start, so I am trying to look into the error logs to get a clue about what is wrong.
My first question is: What is the general way to find where the error log is? I've done a lot of search but it seems to me in different system, and with different setting, these error logs could be in different places, and the filename is also different. Although I've managed to find them under /var/log/mysql/
(which is different from every source I was able to find), I'd like to know how to find these logs' location in general. I think there should be some configuration file in control of this, right? Besides, on some webpage a mysql.log
file is mentioned, but I can't find where it is.
Secondly, under /var/log/mysql
, there are files like error.log
and error.log.1.gz
, error.log.2.gz
. Except the error.log
file, in order to read other files I have to extract them first. Is there any way, like some mysql command , to read them directly?
Best Answer
Logfiles have been stored under
/var/log/
for a long time now. It was changed to that location so they are added to "logrotate" by default. You can expect any log file in Ubuntu in/var/log/
.The logs with numbers are older logs. Log files get compressed at some point by "logrotate". The settings for when it gets compressed are stored in
/etc/logrotate.conf
and by default files are compressed "weekly".No you can't. And no that 1st part is not correct. 2 reasons:
gz
are at least a week old why would you need to see them? A week old errors are too old to be of any use.You can view log files that are compressed.
will show the lines of the file without uncompressing them.
And to add: log viewer also shows compressed log files. ALl you need to do is add the log file to the viewer (see "open" in the settings):