Uploaded image for project: 'HipChat'
  1. HipChat
  2. HCPUB-546

Increase frequency of log rotation checks in HipChat Server

This issue belongs to an archived project. You can view it, but you can't modify it. Learn more

XMLWordPrintable

    • Icon: Suggestion Suggestion
    • Resolution: Won't Fix
    • None
    • Admin issues
    • None
    • Our product teams collect and evaluate feedback from a number of different sources. To learn more about how we use customer feedback in the planning process, check out our new feature policy.

      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:

      1. log into the HipChat Server terminal/command-line interface
      2. create a new file in /home/admin/startup_scripts called 'logrotate_crontab' or similar - do not include a file extension in the name
      3. 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
      4. save the file, then make it executable with chmod +x <filename>
      5. run the script with /home/admin/startup_scripts/<filename>
      6. 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.

              Unassigned Unassigned
              scovey Shanye
              Archiver:
              mandreacchio Michael Andreacchio

                Created:
                Updated:
                Resolved:
                Archived: