Audit Trail API

Log in a third-party storage

To store the audit log in an additional third-party storage, to send a notification, or just monitor the logged events, implement an IAuditLogger with its single Log method in the following way:

Register the logger in the container (a name is required) in the following way:

For more details on implementation, see Integrate Audit trail module with Elasticsearch and Kibana

NOTE: The Log method is called synchronously during event handling, which means that the time your logging takes is added to the overall operation time (for example, to publishing an item). Plan carefully the performance implications and if needed, introduce some asynchronicity in your code. Alternatively, introduce an out-of-process message queue or a logging agent to ensure the quick completion of the operation.

Log additional or custom events

To implement audit for your custom events or for Sitefinity's CMS events not implemented out-of-the-box, register an event handler along with the corresponding converters as demonstrated by the following code:

Event code

Global.asax

Augment logged information

To augment the logged event information, for instance loading additional information, implement an IAuditInfoProcessor with its single Process method and register it the container (the name is required).

Following is an example code that adds the display name of the current user (first name and last name) to each log entry:

Event code

Global.asax

Increase your Sitefinity skills by signing up for our free trainings. Get Sitefinity-certified at Progress Education Community to boost your credentials.

Get started with Integration Hub | Sitefinity Cloud | Sitefinity SaaS

This free lesson teaches administrators, marketers, and other business professionals how to use the Integration hub service to create automated workflows between Sitefinity and other business systems.

Web Security for Sitefinity Administrators

This free lesson teaches administrators the basics about protecting yor Sitefinity instance and its sites from external threats. Configure HTTPS, SSL, allow lists for trusted sites, and cookie security, among others.

Foundations of Sitefinity ASP.NET Core Development

The free on-demand video course teaches developers how to use Sitefinity .NET Core and leverage its decoupled architecture and new way of coding against the platform.

Was this article helpful?