You are here


The API by which applications can query the audit logs and enable or disable auditing.
Information AuditService
Support Status Full Support
Architecture Information Platform Architecture
Description The AuditService API provides faciities to query audit data. There are also methods to clear audit data, enable and disable auditing, and check auditing status.
Deployment - App Server It is not likely that you will deploy Java extensions directly into a Tomcat application server as classes and Spring context files. Use an SDK build project instead.
Deployment All-in-One SDK project.
  • Java source code: aio/platform-jar/src/main/java/{domain specific package path}
  • Spring beans: aio/platform-jar/src/main/resources/alfresco/module/platform-jar/context/service-context.xml
Java API Java API Documentation
Java example
     * Returns content changes.
    public ObjectList getContentChanges(Holder<String> changeLogToken, BigInteger maxItems)
        final ObjectListImpl result = new ObjectListImpl();
        result.setObjects(new ArrayList<ObjectData>());

        EntryIdCallback changeLogCollectingCallback = new EntryIdCallback(true)
            public boolean handleAuditEntry(Long entryId, String user, long time, Map<String, Serializable> values)
                result.getObjects().addAll(createChangeEvents(time, values));
                return super.handleAuditEntry(entryId, user, time, values);

        Long from = null;
        if ((changeLogToken != null) && (changeLogToken.getValue() != null))
                from = Long.parseLong(changeLogToken.getValue());
            catch (NumberFormatException e)
                throw new CmisInvalidArgumentException("Invalid change log token: " + changeLogToken);

        AuditQueryParameters params = new AuditQueryParameters();

        int maxResults = (maxItems == null ? 0 : maxItems.intValue());
        maxResults = (maxResults < 1 ? 0 : maxResults + 1);

        auditService.auditQuery(changeLogCollectingCallback, params, maxResults);

        String newChangeLogToken = null;
        if (maxResults > 0)
            if (result.getObjects().size() >= maxResults)
            	StringBuilder clt = new StringBuilder();
                newChangeLogToken = (from == null ? clt.append(maxItems.intValue() + 1).toString() : clt.append(from.longValue() + maxItems.intValue()).toString());
                result.getObjects().remove(result.getObjects().size() - 1).getId();

        if (changeLogToken != null)

        return result;
More Information

Sending feedback to the Alfresco documentation team

You don't appear to have JavaScript enabled in your browser. With JavaScript enabled, you can provide feedback to us using our simple form. Here are some instructions on how to enable JavaScript in your web browser.