The 5.7 branch of Magnolia reached End-of-Life on December 31, 2023, as specified in our End-of-life policy. This means the 5.7 branch is no longer maintained or supported. Please upgrade to the latest Magnolia release. By upgrading, you will get the latest release of Magnolia featuring significant improvements to the author and developer experience. For a successful upgrade, please consult our Magnolia 6.2 documentation. If you need help, please contact info@magnolia-cms.com.

Audit trail allows an administrator to record of user activity in the system. An audit trail typically captures the "who, what, when and where". The default implementation is based on Log4j 2 and the files used for logging can therefore be configured in any way you like. Magnolia also provides a Log Viewer tool, located in the Tools menu, to visualize these and other log files.

Configuration

This feature is configured in two places, log4j2.xml file and in auditLogging configuration.

log4j2.xml

Here you define the loggers to be used by the audit logging. Here is an example extracted from the application log4j2.xml :

<RollingFile name="sync-log-audit"
             fileName="${magnolia.logs.dir}/magnolia-audit.log"
             filePattern="${magnolia.logs.dir}/magnolia-audit-%i.log"
             append="true">
   <PatternLayout pattern="%d{dd.MM.yyyy HH:mm:ss}%m%n"/>
  <Policies>
    <SizeBasedTriggeringPolicy size="1MB"/>
  </Policies>
  <DefaultRolloverStrategy max="5"/>
</RollingFile>
<Async name="log-audit">
  <AppenderRef ref="sync-log-audit"/>
</Async>

auditLogging configuration

Define the actions you want to log in auditLogging configuration. You can enable the preconfigured actions and define which logger they should use. Define separators for each action or use the default separator (comma) for all of them.

Node name

Value

 
server


 
auditLogging


 
logConfigurations


 
deactivate


 
activate


 
active

false

 
logName

log-audit

 
copy


 
login


 
logout


 
move


 
modify


 
create


 
delete


 
class

info.magnolia.audit.AuditLoggingManager

 
defaultSeparator

,

Below is an extract of the output of the logs. General pattern is "when, what, who and where".

20.10.2008 11:59:33 , create , superuser , website , /untitled4

move and copy actions log the source node path and the destination node path.

login action logs the IP address and the result.

21.10.2008 12:21:59, logout, anonymous
21.10.2008 12:22:05, login, superuser, 127.0.0.1, Success
  • No labels