Enable Audit Logging

Introduction

The audit logger component allows the logging of events posted to the Event Bus service to a plain Log4j 2 file. The event objects received from the Event Bus are encoded in a JSON string and logged at info level to an SLF4J logger. Currently, by default, the CMS posts events to the event bus about all workflow actions plus CMS log-in and CMS log-out events. Any events posted to this bus by custom plugins or applications are also logged.

Configure Log4j 2

Projects created using a recent Maven archetype already have audit logging configured by default.

To enable audit logging in other projects, add the following appender to conf/log4j2-dist.xml - this will log the audit information to the file hippo-audit.log.

    <!-- audit.log -->
    <RollingFile name="audit" fileName="${sys:catalina.base}/logs/audit.log"
                 filePattern="${sys:catalina.base}/logs/audit.log.%d{yyyy-MM-dd}">
      <PatternLayout pattern="%d{dd.MM.yyyy HH:mm:ss} [%t] %-5p [%C.%M():%L] %m%n"/>
      <Policies>
        <TimeBasedTriggeringPolicy/>
      </Policies>
    </RollingFile>

Next, add the following loggers:

    <!-- audit logging -->
    <Logger additivity="false" name="org.hippoecm.repository.api.Workflow" level="info">
      <AppenderRef ref="audit"/>
    </Logger>
    <Logger additivity="false" name="org.onehippo.audit" level="info">
      <AppenderRef ref="audit"/>
    </Logger>

Sample output

19.02.2013 16:02:05 INFO  [org.hippoecm.repository.audit.AuditLogger.logHippoEvent():39] {"message":"login successful","timestamp":1361286125920,"category":"security","application":"cms","remoteAddress":"0:0:0:0:0:0:0:1","action":"login","user":"admin","success":true}
19.02.2013 16:02:34 INFO  [org.hippoecm.repository.audit.AuditLogger.logHippoEvent():39] {"result":"document[uuid=cc4b3805-43f8-408c-81b5-466d1cb6f3f9,path='/content/documents/hippogogreen/news/2012/10/report-green-technology-trends-2013-copy/report-green-technology-trends-2013-copy']","application":"repository","interactionId":"0bc97c5e-5336-4e36-be91-8b98e1bd36c2","returnValue":"document[uuid=cc4b3805-43f8-408c-81b5-466d1cb6f3f9,path='/content/documents/hippogogreen/news/2012/10/report-green-technology-trends-2013-copy/report-green-technology-trends-2013-copy']","documentPath":"/content/documents/hippogogreen/news/2012/10","interaction":"default:reviewedactions:copy","returnType":"document","timestamp":1361286154745,"category":"workflow","arguments":["org.hippoecm.repository.api.Document[uuid=3d481407-4328-4107-b28b-d5dc8e47211e]","org.hippoecm.repository.reviewedactions.PublishableDocument[uuid=963e88f2-7a45-48a9-9b40-00e72389ff57]","report-green-technology-trends-2013-copy","<null>"],"workflowName":"folder-extended","action":"org.hippoecm.repository.standardworkflow.FolderWorkflowImpl.copyTo","className":"org.hippoecm.repository.standardworkflow.FolderWorkflowImpl","user":"admin","methodName":"copyTo","workflowCategory":"embedded"}
19.02.2013 16:02:34 INFO  [org.hippoecm.repository.audit.AuditLogger.logHippoEvent():39] {"result":"document[uuid=cbdbcc58-20ea-4352-9441-59904a401d27,path='/jcr:system/jcr:versionStorage/cc/4b/38/cc4b3805-43f8-408c-81b5-466d1cb6f3f9/1.0']","application":"repository","interactionId":"0bc97c5e-5336-4e36-be91-8b98e1bd36c2","returnValue":"document[uuid=cbdbcc58-20ea-4352-9441-59904a401d27,path='/jcr:system/jcr:versionStorage/cc/4b/38/cc4b3805-43f8-408c-81b5-466d1cb6f3f9/1.0']","documentPath":"/content/documents/hippogogreen/news/2012/10/report-green-technology-trends-2013-copy/report-green-technology-trends-2013-copy","interaction":"default:reviewedactions:copy","returnType":"document","timestamp":1361286154837,"category":"workflow","workflowName":"version","action":"org.hippoecm.repository.standardworkflow.VersionWorkflowImpl.version","handleUuid":"1ccf10a4-b324-4cd7-9d28-58cf3fdded70","className":"org.hippoecm.repository.standardworkflow.VersionWorkflowImpl","user":"workflowuser","methodName":"version","workflowCategory":"versioning"}
19.02.2013 16:02:34 INFO  [org.hippoecm.repository.audit.AuditLogger.logHippoEvent():39] {"timestamp":1361286154837,"category":"workflow","application":"repository","workflowName":"reviewedactions","interactionId":"0bc97c5e-5336-4e36-be91-8b98e1bd36c2","documentPath":"/content/documents/hippogogreen/news/2012/10/report-green-technology-trends-2013-copy/report-green-technology-trends-2013-copy","action":"org.hippoecm.repository.reviewedactions.FullReviewedActionsWorkflowImpl.depublish","handleUuid":"1ccf10a4-b324-4cd7-9d28-58cf3fdded70","interaction":"default:reviewedactions:copy","className":"org.hippoecm.repository.reviewedactions.FullReviewedActionsWorkflowImpl","methodName":"depublish","user":"admin","workflowCategory":"default"}
19.02.2013 16:02:34 INFO  [org.hippoecm.repository.audit.AuditLogger.logHippoEvent():39] {"application":"repository","interactionId":"0bc97c5e-5336-4e36-be91-8b98e1bd36c2","documentPath":"/content/documents/hippogogreen/news/2012/10/report-green-technology-trends-2013/report-green-technology-trends-2013","interaction":"default:reviewedactions:copy","timestamp":1361286154837,"category":"workflow","arguments":["org.hippoecm.repository.api.Document[uuid=3d481407-4328-4107-b28b-d5dc8e47211e]","report-green-technology-trends-2013-copy"],"workflowName":"reviewedactions","action":"org.hippoecm.repository.reviewedactions.FullReviewedActionsWorkflowImpl.copy","handleUuid":"4c7bcc24-f8a1-4f23-ab46-ab92bfaf7900","className":"org.hippoecm.repository.reviewedactions.FullReviewedActionsWorkflowImpl","user":"admin","methodName":"copy","workflowCategory":"default"}
19.02.2013 16:02:34 INFO  [org.hippoecm.repository.audit.AuditLogger.logHippoEvent():39] {"application":"repository","interactionId":"9fc6efea-5764-4cdd-9839-5b68fb70b295","documentPath":"/content/documents/hippogogreen/news/2012/10/report-green-technology-trends-2013-copy/report-green-technology-trends-2013-copy","interaction":"core:default:localizeName","timestamp":1361286154942,"category":"workflow","arguments":["Report: Green Technology Trends 2013 (copy)"],"workflowName":"default","action":"org.hippoecm.repository.standardworkflow.DefaultWorkflowImpl.localizeName","handleUuid":"1ccf10a4-b324-4cd7-9d28-58cf3fdded70","className":"org.hippoecm.repository.standardworkflow.DefaultWorkflowImpl","user":"admin","methodName":"localizeName","workflowCategory":"core"}
19.02.2013 16:02:38 INFO  [org.hippoecm.repository.audit.AuditLogger.logHippoEvent():39] {"result":"document[uuid=75070051-64af-47cd-93fc-b2c694748deb,path='/jcr:system/jcr:versionStorage/cc/4b/38/cc4b3805-43f8-408c-81b5-466d1cb6f3f9/1.1']","application":"repository","interactionId":"8d1088d4-a781-4729-bcd5-2f9cc14e2037","returnValue":"document[uuid=75070051-64af-47cd-93fc-b2c694748deb,path='/jcr:system/jcr:versionStorage/cc/4b/38/cc4b3805-43f8-408c-81b5-466d1cb6f3f9/1.1']","documentPath":"/content/documents/hippogogreen/news/2012/10/report-green-technology-trends-2013-copy/report-green-technology-trends-2013-copy","interaction":"default:reviewedactions:publish","returnType":"document","timestamp":1361286158292,"category":"workflow","workflowName":"version","action":"org.hippoecm.repository.standardworkflow.VersionWorkflowImpl.version","handleUuid":"1ccf10a4-b324-4cd7-9d28-58cf3fdded70","className":"org.hippoecm.repository.standardworkflow.VersionWorkflowImpl","user":"workflowuser","methodName":"version","workflowCategory":"versioning"}
19.02.2013 16:02:38 INFO  [org.hippoecm.repository.audit.AuditLogger.logHippoEvent():39] {"timestamp":1361286158292,"category":"workflow","application":"repository","workflowName":"reviewedactions","interactionId":"8d1088d4-a781-4729-bcd5-2f9cc14e2037","documentPath":"/content/documents/hippogogreen/news/2012/10/report-green-technology-trends-2013-copy/report-green-technology-trends-2013-copy","action":"org.hippoecm.repository.reviewedactions.FullReviewedActionsWorkflowImpl.publish","handleUuid":"1ccf10a4-b324-4cd7-9d28-58cf3fdded70","interaction":"default:reviewedactions:publish","className":"org.hippoecm.repository.reviewedactions.FullReviewedActionsWorkflowImpl","methodName":"publish","user":"admin","workflowCategory":"default"}
Did you find this page helpful?
How could this documentation serve you better?
On this page
    Did you find this page helpful?
    How could this documentation serve you better?