Hi guys,
I have noticed a problem with log files on my system that are growing and slowly filling up my small boot and / drive. After a bit of work it seems the culprit is the Monit log file. Any ideas on how to limit the Monit log file to a sensible size?
My server is not very standard as I have a 64Gb SSD drive from which I boot and have the OS installed on, plus a Raid 5 array of 4 disks with all my shares. Hence I have steadily noticed a slow decrease in available disk space on my boot drive.
Thanks in advance for the help.
SOLVED: Drive filling up. How to limit the log size of Monit
-
- Posts: 24
- Joined: Tue Dec 27, 2016 5:33 am
Re: Drive filling up. How to limit the log size of Monit
My first concern would be why the log file is getting so large. Are there errors being repeatedly written to the file? If so, the answer would be to correct them, not limit the log size.
BTW, log files are rotated when they reach a predetermined size. The old logs are often gzipped or sometimes just renamed with a date stamp added.
The best option is to eliminate the back up logs from the /var/log directory. I created a bash script on my HDA to do just that. I can set it to run periodically via a cron job or just manually.
BTW, log files are rotated when they reach a predetermined size. The old logs are often gzipped or sometimes just renamed with a date stamp added.
The best option is to eliminate the back up logs from the /var/log directory. I created a bash script on my HDA to do just that. I can set it to run periodically via a cron job or just manually.
ßîgƒσστ65
Applications Manager
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2
Applications Manager
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2
-
- Posts: 24
- Joined: Tue Dec 27, 2016 5:33 am
Re: Drive filling up. How to limit the log size of Monit
Hi mate,
Yep its just the backup logs. Good idea about the script. Any chance that you can share?
Yep its just the backup logs. Good idea about the script. Any chance that you can share?
Re: Drive filling up. How to limit the log size of Monit
I basically created a script file in my user's directory as follows:
You could also create a cron job to run it periodically.
This is another one I found searching the internet to remove log older 180 days:
I then made it executable, and run it occasionally.sudo rm -rf /var/log/*.gz
sudo rm -rf /var/log/*.log-2017*
sudo rm -rf /var/log/*-2017*
You could also create a cron job to run it periodically.
This is another one I found searching the internet to remove log older 180 days:
#!/bin/sh
find /var/log/ -type f -mtime +180 -delete
ßîgƒσστ65
Applications Manager
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2
Applications Manager
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2
-
- Posts: 24
- Joined: Tue Dec 27, 2016 5:33 am
Re: Drive filling up. How to limit the log size of Monit
Many thanks All sorted
Re: Drive filling up. How to limit the log size of Monit
No problem.
Marking as solved.
Marking as solved.
ßîgƒσστ65
Applications Manager
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2
Applications Manager
My HDA: Intel(R) Core(TM) i5-3570K CPU @ 3.40GHz on MSI board, 16GB RAM, 1TBx1+2TBx2+4TBx2
Who is online
Users browsing this forum: No registered users and 92 guests