delete /var/log/mysqld.log on NAGIOS SQL server

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
jatindeepsharma
Posts: 70
Joined: Wed Apr 04, 2018 10:52 am

delete /var/log/mysqld.log on NAGIOS SQL server

Post by jatindeepsharma »

Hello Team,
Good Morning. I want to delete mysqld.logs from NAGIOS SQL server cause their size is huge , its about 20GB. i have seen these logs & they include error messages of database table crashed in it.
Is it safe to delete these logs, if yes then how can i delete these logs?

Example of logs in mysqld.log file is given below.

180305 9:49:37 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
180305 9:49:37 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
180305 9:49:37 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
180305 9:49:37 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed
180305 9:49:37 [ERROR] /usr/libexec/mysqld: Table './nagios/nagios_logentries' is marked as crashed and last (automatic?) repair failed


Regards
Jatindeep Sharma
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: delete /var/log/mysqld.log on NAGIOS SQL server

Post by scottwilkerson »

This is showing that you actually have a database error, you should run the following repair procedure
https://assets.nagios.com/downloads/nag ... tabase.pdf


Once completed you can clear the log and free up the space by running the following:

Code: Select all

cat /dev/null > /var/log/mysqld.log
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jatindeepsharma
Posts: 70
Joined: Wed Apr 04, 2018 10:52 am

Re: delete /var/log/mysqld.log on NAGIOS SQL server

Post by jatindeepsharma »

Hello scottwilkerson,
Thanks for prompt reply.
For your information these error logs in mysqld.log file are from 2018, right now database is working fine & there is not any error in any of table(logentries, notifications & statehistory).
can i delete these logs by this command given below by you if everything is running fine & please also let me know do i have to stop mysqld service before running the command provided by you.

Regards
jatindeep sharma
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: delete /var/log/mysqld.log on NAGIOS SQL server

Post by scottwilkerson »

Ok, you can do the following without stopping the service

Code: Select all

cat /dev/null > /var/log/mysqld.log
This clears the file while maintaining it's existence and proper permissions
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
jatindeepsharma
Posts: 70
Joined: Wed Apr 04, 2018 10:52 am

Re: delete /var/log/mysqld.log on NAGIOS SQL server

Post by jatindeepsharma »

Thanks scottwilkerson for your help. I have deleted the same.

Regards
Jatindeep Sharma
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: delete /var/log/mysqld.log on NAGIOS SQL server

Post by scottwilkerson »

jatindeepsharma wrote:Thanks scottwilkerson for your help. I have deleted the same.

Regards
Jatindeep Sharma
Great!

Locking thread
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
Locked