Page 1 of 1
Safe way to clear a couple of logs
Posted: Tue Jul 25, 2017 2:01 pm
by PhilG
Hello:
We are running Nagios XI 5.2.7 and had to run a backup and then run a repair after noting the following log entry in "/var/log/mysqld.log":
"... [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed"
The repair appears to have worked.
I noted that "/var/log/mysqld.log" is a little larger than what I would like:
463467556 Jul 25 13:29 mysqld.log
Also, the disk space directory culprit is "/var/log/httpd":
342896 /var/log/httpd/ssl_request_log.1
318992 /var/log/httpd/ssl_access_log.1
What is the "safe" way to clear the mysqld log that is in use, and where do we set a cap on the logs?
Thank you in advance for your assistance.
Re: Safe way to clear a couple of logs
Posted: Tue Jul 25, 2017 2:51 pm
by PhilG
I stand corrected regarding that the repair worked. I noted that "Notifications are disabled for this host" for ALL Hosts and that the Host appears in the Service Status window with a grey background (Host check is pending...", and stays the same even after forcing an immediate check.
Re: Safe way to clear a couple of logs
Posted: Tue Jul 25, 2017 3:15 pm
by PhilG
UPDATE: Nevermind. I did a server restart and the problem does not appear anymore.
PhilG wrote:I stand corrected regarding that the repair worked. I noted that "Notifications are disabled for this host" for ALL Hosts and that the Host appears in the Service Status window with a grey background (Host check is pending...", and stays the same even after forcing an immediate check.
Re: Safe way to clear a couple of logs
Posted: Tue Jul 25, 2017 3:45 pm
by ssax
You can clear
/var/log/mysqld.log with this command:
But you may want to setup logrotate to handle it automatically, I think you can uncomment this section in your
/etc/logrotate.d/mysqld:
Code: Select all
#/var/log/mysqld.log {
# create 640 mysql mysql
# notifempty
# daily
# rotate 3
# missingok
# compress
# postrotate
# # just if mysqld is really running
# if test -x /usr/bin/mysqladmin && \
# /usr/bin/mysqladmin ping &>/dev/null
# then
# /usr/bin/mysqladmin flush-logs
# fi
# endscript
#}
So that it looks like this:
Code: Select all
/var/log/mysqld.log {
create 640 mysql mysql
notifempty
daily
rotate 3
missingok
compress
postrotate
# just if mysqld is really running
if test -x /usr/bin/mysqladmin && \
/usr/bin/mysqladmin ping &>/dev/null
then
/usr/bin/mysqladmin flush-logs
fi
endscript
}
That should take care of it.
Re: Safe way to clear a couple of logs
Posted: Tue Jul 25, 2017 3:59 pm
by PhilG
Which command, please, since only the log file and path appear in the code section?
ssax wrote:You can clear
/var/log/mysqld.log with this command:
....
Re: Safe way to clear a couple of logs
Posted: Tue Jul 25, 2017 4:10 pm
by bolson
It isn't a command... It's the right arrow key (greater than sign) as shown.
Re: Safe way to clear a couple of logs
Posted: Wed Jul 26, 2017 8:37 am
by PhilG
Thank you.
You may close this post.
Re: Safe way to clear a couple of logs
Posted: Wed Jul 26, 2017 9:11 am
by bolson
Closing topic as resolved.
Thank you for using the Nagios Support Forum!