Fetching audit records from Alfresco

In Alfresco all the actions performed by any user are audited and stored in the Alfresco database. These records can be fetched any time by the admin user. There is web-script exposed which can be used to fetch and delete the audit entries from Alfresco. This can be only performed by admin users. We learned about audit configuration in Chapter 3, Alfresco Configuration.

To fetch the audit records from Alfresco there is a get service exposed by Alfresco, which can be found at the following URL.

  • /alfresco/service/api/audit/query/{application}?fromId={fromId}&toId={toId}&fromTime={fromTime}&toTime={toTime}&user={user}&forward={forward}&limit={limit}&verbose={verbose}

The parameters involved are explained as follows:

  • application: Audits are divided into different applications. By default everything is under alfresco-access. So pass the application name as alfresco-access.
  • fromId&toId: If you know the audit ID number you can use these parameters. Mostly you can skip them.
  • fromTime&toTime: This passes the time in milliseconds to fetch the audit record based on a specified duration.
  • user: This parameter will allow you to fetch audit records for a specified user.
  • limit: This parameter will limit the number of audit records in response. Make sure you use this parameter so that the system is not overloaded and fetches a lot of audit records.
  • verbose: This parameter can be false/true. If true it will send more details in the JSON response.

Alfresco also allows you to delete audit records. You can call the following POST URL to delete the records, pass the application name, and duration of time for which audit records need to be deleted:

  • /alfresco/service/api/audit/clear/{application}?fromTime={fromTime}&toTime={toTime}

Use this service cautiously, as it will remove the audit records permanently from the system. Also try to provide a small duration so that the system doesn't get overloaded.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset