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
delete /var/log/mysqld.log on NAGIOS SQL server
-
- Posts: 70
- Joined: Wed Apr 04, 2018 10:52 am
-
- 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
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:
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
-
- Posts: 70
- Joined: Wed Apr 04, 2018 10:52 am
Re: delete /var/log/mysqld.log on NAGIOS SQL server
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
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
-
- 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
Ok, you can do the following without stopping the service
This clears the file while maintaining it's existence and proper permissions
Code: Select all
cat /dev/null > /var/log/mysqld.log
-
- Posts: 70
- Joined: Wed Apr 04, 2018 10:52 am
Re: delete /var/log/mysqld.log on NAGIOS SQL server
Thanks scottwilkerson for your help. I have deleted the same.
Regards
Jatindeep Sharma
Regards
Jatindeep Sharma
-
- 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
Great!jatindeepsharma wrote:Thanks scottwilkerson for your help. I have deleted the same.
Regards
Jatindeep Sharma
Locking thread