Skip to content

Customize Apache's log rotation

technicalpickles edited this page Mar 5, 2013 · 1 revision

Moonshine provides logrotate for apache's directory automatically. By default, this happens weekly and 52 logs are kept (ie one year).

But sometimes it's desirable to adjust a little bit, for example to keep longer for a longer audit trail, or to rotate more frequently to keep individual log sizes down (super big logs can cause the Scout Apache Log Analyzer plugin to time out, for example.

To keep longer have a longer audit trail:

# in config/moonshine.yml
:apache:
  :logrotate:
    :count: 104 # two years, instead of 1 year

To rotate daily, instead of weekly, for a year:

# in config/moonshine.yml
:apache:
  :logrotate:
    # rotate daily for a year, instead of weekly for a year
    # in order to keep apache log size small and parsable by scout
    :frequency: daily
    :count: 365 

Commit, push and deploy. Then you should see your changes reflected in /etc/logrotate.d/apache2, and see the effects the next time logrotate runs.

Clone this wiki locally