Creating a rotating audit log file
You can create rotating audit log file at a regular interval, such as every day.
About this task
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 , 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=falseProcedure
-
Edit the log4j.properties file.
Use a text editor to edit the file. You can also access the file by clicking .
- Modify the appenders.
- Restart the server.
-
Verify the logs generating in the
/var/log/audit.logfile.
What to do next
This feature works especially well with audit log cleanup enabled. Go to to enable audit log cleanup. Additionally, configure your audit log settings from the Server settings as required.