2 Replies Latest reply on Nov 26, 2012 8:24 PM by Kristian Wright

    CQ5 Logging Strategy

    Kristian Wright Level 1

      Hi everyone,

       

      I'm looking into a good logging strategy for the CQ5 instances we're running.  Out of the box, the logging config sets the logs to rotate on a daily basis, with no limit set on the amount of log files that are produced.  Obviously this is not the most optimal solution for a production environment, since if this is left unchecked it will continue to eat into disk space until logs are manually cleared out.  Setting the number of log files and log file threshold to a size rather than a date can prevent this issue, but this is not optimal if we want to keep track of logs on a daily basis (as defined by the default date pattern logging).

       

      We're looking to keep a daily rotation of logs, but only keep the past 14 days.  We can do this with 3rd party logging tools to rotate and delete the logs where required, or even use a cron job to deal with them, but I was wondering if there was a way that CQ5 could manage this issue itself without any external dependancies.

       

      Does anyone have any thoughts about good ways to approach this?

       

      Thanks,

      K

        • 2. Re: CQ5 Logging Strategy
          Kristian Wright Level 1

          Thanks for the links Rush.

           

          I've already had a look through them, but I took another quick look just to confim something.  Regarding rotating the logs, the docs state:

           

          org.apache.sling.commons.log.file.size controls the rotation of the log file by setting either:

          • a maximum file size
          • a time/date schedule

          to indicate when a new file will be created (and the existing file renamed according to the name pattern).

           

          So based on this, if I set the 'Number of Log Files' to 14 and set the 'Log File Threshold' to 200MB for my error.log, I'll get up to 14 error.log.n files and then the files will rotate at 200MB up to 14 times.  If I set set the 'Number of Log Files' to 14 and set the 'Log File Threshold' to '.'yyyy-MM-dd, I'll get 1 error.log..yyyy-MM-dd file per day, but the Number of Log Files is ignored.  Unless I manually intervene, these log files will never be removed from the system and continue to eat disk space.

           

          What I'm hoping for is that CQ5 can be configured in any way to have a blend of the two types - 'Number of Log Files' is14 and the 'Log File Threshold' is '.'yyyy-MM-dd, which would mean that the log files are rotated each day, but are purged by CQ5 after 14 days.

           

          From my understanding of the docs this is not possible regarding this general log writer configuration, but is there another way in CQ5 to achieve this?

           

          Thanks,

          K