Log rotation

View thread

amani

What is the best way to do a log rotation?

I'm using fileop and I wanted log rotation at midnight, but it hasn't been working. Would it be better to move the Schedule to the Output section?

<Extension fileop>
    Module      xm_fileop

    # Check the size of our log file every hour and rotate if it is larger than 1Mb
    <Schedule>
        Every   1 hour
        Exec    if (file_size('%LOGFILE%') >= 1M) file_cycle('%LOGFILE%', 500);
    </Schedule>

    # Rotate our log file every week on sunday at midnight
    <Schedule>
        When    @midnight
        Exec    file_cycle('%LOGFILE%', 500);
    </Schedule>
</Extension>