Creating a rotating audit log file

You can create rotating audit log file at a regular interval, such as every day.

You can create a rotating audit log file by adding the audit-log-to-file appenders to the log4j.properties. Starting with 7.0.1.1, you can find the appenders in the log4j.properties file. Go to Settings > Logging, and uncomment the respective appenders.

The following code fragment shows the audit-log-to-file appenders to be used to create a rotating audit log file:
log4j.appender.audit-log-to-file=org.apache.log4j.DailyRollingFileAppender
log4j.appender.audit-log-to-file.File=../var/log/audit.log
log4j.appender.audit-log-to-file.MaxFileSize=100MB
log4j.appender.audit-log-to-file.DatePattern='.'yyyy-MM-dd
log4j.appender.audit-log-to-file.layout=org.apache.log4j.PatternLayout
log4j.appender.audit-log-to-file.layout.ConversionPattern=%m%n
log4j.logger.AuditLog=DEBUG, audit-log-to-file
log4j.additivity.AuditLog=false
  1. Edit the log4j.properties file.
    Use a text editor to edit the file. You can also access the file by clicking Settings > Logging.
  2. Modify the appenders.
  3. Restart the server.
  4. Verify the logs generating in the /var/log/audit.log file.

This feature works especially well with audit log cleanup enabled. Go to Settings > System > Audit Log > Audit Log settings > Enable Audit Log Cleanup to enable audit log cleanup. Additionally, configure your audit log settings from the Server settings as required.