
h1. Audit Trails Configuration



h1. Introduction

Audit Trails in eXo are based on JCR operations. The corresponding interface is described in [Audit Trails Management].

h1. Configuration File
You find the audit configuration file here:
...portal/WEB-INF/conf/dms/jcr-component-plugins-configuration.xml

The current default configuration looks like:

{code:xml}
  <external-component-plugins>
    <target-component>org.exoplatform.services.jcr.impl.ext.action.SessionActionCatalog</target-component>    	

<component-plugin>
	    <name>addActions</name>
	    <set-method>addPlugin</set-method>
	    <type>org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin</type>
	    <description>add actions plugin</description>
	    <init-params>
	      <object-param>
	        <name>actions</name>
	        <object type="org.exoplatform.services.jcr.impl.ext.action.AddActionsPlugin$ActionsConfig">
	          <field  name="actions">
	            <collection type="java.util.ArrayList">
<!-- Uncomment this tag if you wish to enable audit in the entire workspace by default.
                  <value>
                    <object type="org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration">
                      <field  name="eventTypes"><string>addNode</string></field>
                      <field name="path"><string>/</string></field>
                      <field  name="isDeep"><boolean>true</boolean></field>
                      <field name="actionClassName"><string>org.exoplatform.services.jcr.ext.audit.AddAuditableAction</string></field>
                   </object>
                  </value>
-->
	              <value>
	                <object type="org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration">
	                  <field  name="eventTypes"><string>addProperty,changeProperty,removeProperty</string></field>
	                  <field  name="path"><string>/</string></field>
	                  <field  name="nodeTypes"><string>exo:auditable</string></field>
	                  <field  name="isDeep"><boolean>true</boolean></field>
	                  <field  name="actionClassName"><string>org.exoplatform.services.jcr.ext.audit.AuditAction</string></field>
	                </object>
	              </value>
	              <value>
	                <object type="org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration">
	                  <field  name="eventTypes"><string>addMixin</string></field>
	                  <field  name="path"><string>/</string></field>
	                  <field  name="nodeTypes"><string>exo:auditable</string></field>
	                  <field  name="isDeep"><boolean>false</boolean></field>
	                  <field  name="actionClassName"><string>org.exoplatform.services.jcr.ext.audit.AuditAction</string></field>
	                </object>
	              </value>
	              <value>
	                <object type="org.exoplatform.services.jcr.impl.ext.action.ActionConfiguration">
	                  <field  name="eventTypes"><string>removeNode</string></field>
	                  <field  name="nodeTypes"><string>exo:auditable</string></field>
	                  <field  name="isDeep"><boolean>false</boolean></field>
	                  <field  name="actionClassName"><string>org.exoplatform.services.jcr.ext.audit.RemoveAuditableAction</string></field>
	                </object>
	              </value>
	            </collection>
	          </field>
	        </object>
	      </object-param>
	    </init-params>
	  </component-plugin>
  </external-component-plugins>

{code}

1 Details

Be aware of this simple rule: An audit trail is created only if all conditions you have configured are fulfilled. If
* the concerned event corresponds with of the event types,
* the concerned node has one of the node types (if you configured a node type),
* the concerned node matches one of the workspaces you configured (if you configured one), and
* the concerned node matches one of the paths you configured - or any descendant if you configured "true" for "isDeep" (if you configured a path),

then the action you configured in "actionClassName" is triggered.


1.1 Event Types

There are several event types whose names are self-explaining:
* addNode
* addProperty
* changeProperty
* addMixin
* removeProperty
* removeNode
* removeMixin

1.1 Path and Deepness
In the default configuration you see that the path is always "/". That means the root node of the workspaces you configured.
If "isDeep" is true all descendants of the path matches the path condition. If "isDeep" is false only the path and its child nodes matches the path condition.
"/" together with "true" means the whole workspace matches the path condition.

If you wish to enter several paths you have to separate them by commas.

1.1 Auditable NodeType
Always use the exo:auditable node type.

If you don't want to have a node type condition., you just don't provide any node type as you see in the part that is commented in the above configuration.

1.1 Workspace
In the example you don't see any information about the workspace. In that case all workspaces are part of the configuration.
To restrict the configuration to certain workspaces you must add for example:

{code:xml}
   <field  name="workspace"><string>collaboration,system</string></field>
{code}

To configure for the workspaces "collaboration" and "system".


