Enable audit logging
Introduction
The audit logger component allows the logging of events posted to the Event Bus service to a plain log4j 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
To enable audit logging, add the following appender to the file log4j.xml - this will log the audit information to the file hippo-audit.log
log4j.xml appender:
<appender name="audit" class="org.apache.log4j.FileAppender"> <param name="File" value="target/hippo-audit.log"/> <layout class="org.apache.log4j.PatternLayout"> <param name="ConversionPattern" value="%d{dd.MM.yyyy HH:mm:ss} %m%n"/> </layout> </appender>
Next, add the logger to the log4j.xml configuration:
log4j.xml logger:
<category additivity="false" name="org.onehippo.audit"> <level value="info"/> <appender-ref ref="audit"/> </category>
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"}