-
Suggestion
-
Resolution: Won't Fix
-
None
-
None
Problem Definition
logrotate is currently used to rotate any large log files in HipChat Server, preventing file storage from reaching/exceeding maximum capacity.
logrotate is running on a daily cron job, which may not be frequent enough for some environments.
Suggested Solution
Increase the frequency with which logrotate is scheduled to run.
Workaround
Implement more frequent logrotate checks with the following steps:
- log into the HipChat Server terminal/command-line interface
- create a new file in /home/admin/startup_scripts called 'logrotate_crontab' or similar - do not include a file extension in the name
- copy the code below into the file and save it:
#!/bin/bash CHECK=$(sudo dont-blame-hipchat -c "crontab -l | grep -e '\/etc\/cron\.daily\/logrotate' | wc -l") if [ $CHECK -lt 1 ]; then sudo dont-blame-hipchat -c "crontab -l | { cat; echo '* */2 * * * /etc/cron.daily/logrotate'; } | crontab -"; fi
- save the file, then make it executable with chmod +x <filename>
- run the script with /home/admin/startup_scripts/<filename>
- validate the change with sudo dont-blame-hipchat -c "crontab -l"
it should return * */2 * * * /etc/cron.daily/logrotate
This will implement a logrotate job every other hour.
If logrotate frequency needs to be increased or decreased, please modify the cron job settings in this portion of the script above:
* */2 * * * /etc/cron.daily/logrotate
http://www.adminschoice.com/crontab-quick-reference may be helpful for crontab syntax.