Skip to content

Starburst (Trino) Query Audit Logs

Starburst (Trino) query audit logs is a feature that audits queries that users run natively in Starburst (Trino) and presents them in a universal format as Immuta audit logs. Users can view audit records for queries made in Starburst (Trino) against Immuta data sources on the audit page. Immuta audits the activity of Immuta users on Immuta data sources.

Requirements

Best practices: Store audit logs

By default Starburst (Trino) audit logs expire after 90 days. Export the universal audit model (UAM) logs to S3 or ADLS Gen 2, and store audit logs outside of Immuta in order to retain the audit logs long-term.

Audit schema

Each audit message from the Immuta platform will be a one-line JSON object containing the properties listed below.

Property Description Example
action The action associated with the audit log. QUERY
actor.type The Immuta user type of the actor who made the query. USER_ACTOR
actor.id The Immuta user ID of the actor who made the query. taylor@starburst.com
actor.name The Immuta name of the user who made the query. Taylor
actor.identityProvider The IAM the user is registered in. bim is the built-in Immuta IAM. bim
actor.profileId The profile ID of the user who made the query. 10
actionStatus Indicates whether or not the user was granted access to the data. Possible values are FAILURE or SUCCESS. Unauthorized access is not audited for Starburst (Trino). SUCCESS
eventTimestamp The time the query occurred. 2023-06-27T11:03:59.000Z
id The unique Immuta ID of the audit record. This will match the Trino query ID. 20240221_200952_00200_qhadw
tenantId The Immuta SaaS tenant ID. your-immuta.com
targetType The type of targets affected by the query; this value will always be DATASOURCE. DATASOURCE
targets A list of the targets affected by the query. See the example below
auditPayload.type The type of audit record; this value will always be: QueryAuditPayload. QueryAuditPayload
auditPayload.queryId The unique Starburst (Trino) ID of the query. 20240221_200952_00200_qhadw
auditPayload.query The command text of the query that was run in the integration. Immuta truncates the query text to the first 2048 characters. select * from lineitem l join orders o on l.orderkey = o.orderkey limit 10
auditPayload.startTime The date and time the query started in UTC. 2023-06-27T11:03:59.000Z
auditPayload.duration The time the query took in seconds. 0.557
auditPayload.objectsAccessed An array of the data sources accessed in the query. See example below.
auditPayload.objectsAccessed.name The name of the data source accessed in the query. \"tpch\".\"tiny\".\"customer\"
auditPayload.objectsAccessed.datasourceId The Immuta data source ID. 17
auditPayload.objectsAccessed.databaseName The name of the Starburst (Trino) catalog. tpch
auditPayload.objectsAccessed.schemaName The name of the Starburst (Trino) schema. tiny
auditPayload.objectsAccessed.type Specifies if the queried data source is a table or view. Starburst (Trino) queries are always LOGICAL_TABLE, which could be either. LOGICAL_TABLE
auditPayload.objectsAccessed.columns An array of the columns accessed in the query. See example below.
auditPayload.objectsAccessed.columns.name The name of the column. custkey
auditPayload.objectsAccessed.columns.tags An array of the tags on the column. See example below.
auditPayload.objectsAccessed.columns.securityProfile Details about the sensitivity of the column. Available when classification frameworks are configured. See example below.
auditPayload.objectsAccessed.columns.inferred If true, the column accessed has been determined by Immuta based on the available audit information from Starburst (Trino) and query parsing. It was not explicitly provided. true
auditPayload.objectsAccessed.securityProfile A classification for all the columns accessed together. Available when classification frameworks are configured. See example below.
auditPayload.technologyContext.type The technology the query was made in. TrinoContext
auditPayload.technologyContext.trinoUsername The Starburst (Trino) user ID for the user who made the query. taylor@starburst.com
auditPayload.technologyContext.immutaPluginVersion The version of the Immuta plugin in Starburst (Trino). 437-SNAPSHOT
auditPayload.technologyContext.rowsProduced The number of rows returned in the query. 3
auditPayload.version The version of the audit event schema. 1
receivedTimestamp The timestamp of when the audit event was received and stored by Immuta. 2023-06-27T15:18:22.314Z

Example audit record

{
  "id": "20240221_200952_00200_qhadw",
  "action": "QUERY",
  "actionStatus": "SUCCESS",
  "actor": {
    "name": "Taylor",
    "id": "taylor@starburst.com",
    "identityProvider": "bim",
    "profileId": "13",
    "type": "USER_ACTOR"
  },
  "tenantId": "your-immuta.com",
  "targetType": "DATASOURCE",
  "targets": [
    {
      "type": "DATASOURCE",
      "id": "35",
      "name": "Tiny Lineitem",
      "technology": "STARBURST_TRINO"
    },
    {
      "type": "DATASOURCE",
      "id": "33",
      "name": "Tiny Orders",
      "technology": "STARBURST_TRINO"
    }
  ],
  "relatedResources": [],
  "auditPayload": {
    "type": "QueryAuditPayload",
    "version": 1,
    "queryId": "20240417_193813_00005_67mum",
    "query": "select c.name, o.clerk from tpch.tiny.customer c join tpch.tiny.orders o on c.custkey = o.custkey limit 10",
    "startTime": "2024-04-17T19:38:13.651Z",
    "endTime": "2024-04-17T19:38:14.068Z",
    "duration": 417.00005531311035,
    "objectsAccessed": [
      {
        "name": "\"tpch\".\"tiny\".\"customer\"",
        "datasourceId": "17",
        "databaseName": "tpch",
        "schemaName": "tiny",
        "type": "LOGICAL_TABLE",
        "columns": [
          {
            "name": "custkey",
            "tags": [],
            "securityProfile": {
              "sensitivity": {
                "score": "NONSENSITIVE"
              }
            },
            "inferred": true
          },
          {
            "name": "name",
            "tags": [
              {
                "type": "TAG",
                "name": "Discovered.Entity.Person Name",
                "id": "104",
                "source": "curated",
                "context": "manual",
                "deleted": false,
                "transient": false
              },
              {
                "type": "TAG",
                "name": "DSF.Control.Personal",
                "id": "116",
                "source": "curated",
                "context": "manual",
                "deleted": false,
                "transient": false
              },
              {
                "type": "TAG",
                "name": "RAF.Confidentiality.Medium",
                "id": "21882",
                "source": "curated",
                "context": "framework",
                "deleted": false,
                "transient": false,
                "framework": {
                  "id": "9144acdd-f92e-4324-bcd4-d22e49dd895e",
                  "version": "d37671bc-58ef-906f-19b0-daf7ce32e878",
                  "name": "Risk Assessment Framework",
                  "measures": {
                    "sensitivity": "SENSITIVE"
                  }
                }
              }
            ],
            "securityProfile": {
              "sensitivity": {
                "score": "SENSITIVE"
              }
            },
            "inferred": true
          }
        ],
        "tags": [],
        "securityProfile": {
          "sensitivity": {
            "score": "SENSITIVE"
          }
        },
        "directlyReferenced": true
      },
      {
        "name": "\"tpch\".\"tiny\".\"orders\"",
        "datasourceId": "13",
        "databaseName": "tpch",
        "schemaName": "tiny",
        "type": "LOGICAL_TABLE",
        "columns": [
          {
            "name": "clerk",
            "tags": [],
            "securityProfile": {
              "sensitivity": {
                "score": "NONSENSITIVE"
              }
            },
            "inferred": true
          },
          {
            "name": "custkey",
            "tags": [],
            "securityProfile": {
              "sensitivity": {
                "score": "NONSENSITIVE"
              }
            },
            "inferred": true
          }
        ],
        "tags": [],
        "securityProfile": {
          "sensitivity": {
            "score": "NONSENSITIVE"
          }
        },
        "directlyReferenced": true
      }
    ],
    "technologyContext": {
      "trinoUsername": "taylor@immuta.com",
      "immutaPluginVersion": "444",
      "rowsProduced": 10,
      "type": "TrinoContext"
    }
  },
  "eventTimestamp": "2024-02-21T20:09:52.000Z",
  "receivedTimestamp": "2024-02-21T20:09:53.599Z"
}

Limitations

  • objectsAccessed is not available with Hive or Iceberg views.
  • columnsAccessed will include columns related to the query that were not actually accessed in some cases:

    • For row access policies that rely on a column in the queried table, even if that column was not a part of the query, it will be included in the columnsAccessed.
    • For conditional masking, if the policy protects a column accessed, then the conditional column will be included in the columnsAccessed.