Skip to main content
Version: 8.1

Audit Log Displays

Inductive University

View Audit Information

Watch the video

This page documents several ways to view results from the Audit Log System. For more information on how the Audit Log works, see the Audit Log and Profiles page.

Access the Audit Log with Table Functions

Vision

In Vision, you can easily access and display the audit log using table functions.

  1. Ensure you have an Audit Log set up and attached to a project.

  2. Open the Designer and navigate to your Vision project.

  3. Drag a Table component onto a window.

  4. In the Property Editor, click the binding icon for the table's Data property. The Property Binding window will appear.

  5. Select the Functions binding type and choose Audit Log from the Binding Function drop-down menu.

  6. Configure the binding options:

    • Audit Profile Name: Select your Audit Profile.
    • Start Date: Enter the appropriate start date.
    • End Date: Enter the appropriate end date.
    • Polling Mode: Select Relative.

  7. Click OK to apply the binding. The Table will populate with the audit log data based on the selected parameters.

  8. Use the Table Customizer to configure the Table's appearance by reorganizing and hiding columns, making columns sortable, and assigning meaningful headers.

Perspective

Currently, Perspective does not have an automatic way to query the audit log. Instead, you can use a Named Query or the system.util.queryAuditLog function to display audit log data.

Using a Named Query

To display audit log data using a Named Query:

  1. Create the Named Query:

    1. In the Designer, navigate to Project > Named Queries.

    2. Create a new query named AuditLogQuery.

    3. Select the Database Connection that contains the audit log data and enter the following SQL query:

      SELECT * FROM audit_events
      WHERE event_timestamp BETWEEN :startDate AND :endDate
      ORDER BY event_timestamp DESC
    4. Add parameters startDate and endDate with the Data Type DateTime.

  2. Bind the Named Query to a Table:

    1. In a Perspective View, drag a Table component onto the canvas.

    2. Select the Table component and go to the Props section.

    3. Bind the data property to the Named Query you created.

    4. Configure the parameters startDate and endDate to specify the date range for the query.

  3. Customize the Table columns to display the data correctly. This may include formatting dates and adjusting column headers.

  4. Save your changes and launch the Perspective session.

The Table component will now display the audit log data for the specified date range.

For more details, see Named Queries.

Using system.util.queryAuditLog

To display audit log data using the system.util.queryAuditLog function:

  1. In the Designer, drag a Table component onto a new View. Name it auditLogTable for the script example below to work.

  2. Right-click on the root container of the View and select Configure Events....

  3. In the editor, select the appropriate event (e.g., onStartup).

  4. Click the and select Script.

    Example Script
    # Define the start date and end date for the query
    today = system.date.now()
    startDate = system.date.addDays(today, -7) # Example: last 7 days
    endDate = today

    # Query the audit log using the specified date range
    results = system.util.queryAuditLog("AuditLog", startDate, endDate)

    # Set the data property of the Table component with the results
    self.getChild("auditLogTable").props.data = results
  5. The Table component can take the raw output of the system.util.queryAuditLog function. However, you will need to configure the columns in the Table's props to display the data correctly. For instance, the date will show as seconds since the Unix epoch by default, so you may need to format it appropriately.

  6. Save your changes in the Designer.

  7. Open the Perspective session in a browser and you'll see the auditLogTable automatically populates with the audit log data on startup.

For more details, see system.util.queryAuditLog.

Access the Audit Log Using the Database Query Browser

The Database Query Browser allows you to search your database tables to view audit information.

  1. In the Designer, go to the Tools menu and select Database Query Browser. The Database Query Browser window will open.

  2. On the right side under Schema, double-click the audit_events table, then click Execute. The data from the audit_events table will appear in the Resultset tab.

For more details, see Database Query Browser.

Access the Audit Log on the Gateway

Ignition provides a simple interface to view Audit Logs directly on the Gateway:

  1. On the Gateway webpage, navigate to the Config section and scroll down to Security > Auditing.

  2. The Audit Profile page will display. Select the Audit Profile where your information is stored and click More > view log.

  3. Enter specific parameter text if you're looking for something particular, otherwise, enter a Start Date and End Date, then click Search.