Audit Logs Module

Audit logging is one of the enterprise features in our core set of user-management tools.

Frontegg events are automatically being logged from the moment you integrate Frontegg into your application.

To get more out of your audit logs, consider:

STEP 1: Enable Audit Logs

Although Frontegg automatically logs Frontegg events, you need to enable Audit Logs in the Builder to work with them in the Admin Portal.

Go to Home ➜ Builder ➜ Collaboration.

Find the Audit Logs switch and toggle to on.



You now should see the Audit logs in the Admin Portal.


πŸ“˜

Audit Logs Permissions

Ensure that a user can access Audit Logs in the Admin Portal by assigning them a role with Audit Logs permissions.


πŸ“˜

To access the Admin Portal, review the Admin Portal introductory guide.

STEP 2: Configure Data Structure

Configure the data structure for displaying and downloading audit log data.

Go to Home ➜ Builder ➜ Collaboration and click the gear (βš™οΈ) next to Audit Logs.

In the left panel, the settings appear and is where you select the data structure for displaying and downloading data.

Toggle on and off the features based on your preferences.

Whichever data is toggled on is the data displayed and available for download in the Admin Portal.



Add Custom Logging

After you enable audit logging in the Builder, customize what you log by adding your own events.

For instance, you can log events that are specific to your application, like if a user uploads a photo, upgrades a subscription, or pretty much anything.

You just need to add some code to your application from Frontegg's backend SDK and add the event to your data structure.

Here is the code.


import { AuditsClient } from '@frontegg/client'
// Init the audits SDK with the clientId and api key
const auditsClient = new AuditsClient();
await auditsClient.init('YOUR-CLIENT-ID', 'YOUR-API-KEY');

// Send the actual audit JSON (Match the model below to the one defined on the portal) 
await auditsClient.sendAudit({
    tenantId: 'THE-TENANT-ID', 
    user: '[email protected]', 
    resource: 'Portal', 
    action: 'Login', 
    severity: 'Info',
    ip: '68.132.6.137' 
});
from frontegg import FronteggClient
# Init the audits SDK with the clientId and api key
client = FronteggClient("your-client-id", "your-api-key")

# Send the actual audit JSON (Match the model below to the one defined on the portal) 
client.send_audits(
    {
        user: "[email protected]",
        resource: "Portal",
        action: "Login",
        severity: "Info",
        ip: "68.132.6.137",
    },
    tenantId="THE-TENANT-ID",
)

πŸ“˜

You are now pushing data using THE-TENANT-ID to the logs.


Update Data Structure

Add the new event as a field in the data structure.

Go to Home ➜ Builder ➜ Collaboration and click the gear (βš™οΈ) next to Audit Logs.

Click the plus (+) button.



Complete the form.



πŸ“˜

After saving, click back and make sure the new event is toggled on in the left panel Audit Log settings.


You should see the new field as a column in your table.

Export Log Data

You can export the log data to use however you want.

Go to Admin Portal ➜ Audit Logs and click the download button.


πŸ“˜

To access Audit Logs in the Admin Portal, review the Admin Portal introductory guide to gain access to the Admin Portal and enable Audit Logs in the Builder.


πŸ“˜

Configure audit log data structure before downloading or just go with the default data structure.

Automatic Logging

Frontegg comes with automatic audit logging from the moment you integrate it into your application.

We automatically log events that happen when your customers use our product.

For instance, we automatically log user-management events, like when a user logs in or modifies their settings.

Plus, we log performance and maintenance events related to Frontegg's tools, like if a lag is detected or a security audit is performed.

Aside from integrating Frontegg, you do not need to do anything to start the automatic logging process.

To work with the logs, follow the instructions above.


Did this page help you?