---
title: AWS CloudTrail
description: Ingest AWS CloudTrail logs into Lakewatch from cloud storage and schematize them with built-in parsers.
canonical_url: https://docs.databricks.com/gcp/en/lakewatch/ingest-data/supported-logs/aws-cloudtrail
---

# AWS CloudTrail

> [!NOTE]
> **Beta**
>
> Lakewatch is in [Beta](https://docs.databricks.com/gcp/en/release-notes/release-types.md). Workspace admins can control access to this feature from the **Previews** page. See [ Manage workspace-level previews](https://docs.databricks.com/gcp/en/admin/workspace-settings/manage-previews.md#workspace).

## Overview

AWS CloudTrail records account activity and API usage across your AWS infrastructure. Lakewatch ingests CloudTrail logs from cloud storage (Amazon S3) using Auto Loader and schematizes them with built-in parsers. CloudTrail is a cloud storage source, not an API connector.

## Onboard CloudTrail logs

To ingest CloudTrail, create a cloud storage datasource that reads your CloudTrail logs from Amazon S3, and attach the built-in parser that matches the CloudTrail objects you're ingesting so events are written to a schematized parsed table. For prerequisites, Unity Catalog access, and the full datasource setup steps, see [Cloud storage](https://docs.databricks.com/gcp/en/lakewatch/ingest-data/ingestion-methods/cloud-storage.md).

If you choose **AWS CloudTrail** from the **Add new datasource** page, the form sets **Data format** to **CloudTrail logs**, which extracts each event from the JSON Records array. Keep this preset rather than changing it to JSON. The form attaches the `aws_cloudtrail` and `aws_cloudtrail_insight` parsers by default.

### <a id="reduce-cloudtrail-volume" />Reduce CloudTrail volume

Lakewatch ingests every event in the CloudTrail log files that the datasource reads. You can't filter out events before they're parsed, such as S3 data events or events where `managementEvent` is `false`. To reduce volume, configure your trail's event selectors in AWS so that CloudTrail doesn't log the events you don't need. See [Logging data events](https://docs.aws.amazon.com/awscloudtrail/latest/userguide/logging-data-events-with-cloudtrail.html) in the AWS documentation. For how volume works across all datasources, see [Control ingestion volume](https://docs.databricks.com/gcp/en/lakewatch/ingest-data/datasources/index.md#control-ingestion-volume).

If you turn on **Ingest historical data**, the first run also lists and ingests every file already in the location, so listing and ingestion volume is highest while that backfill runs. See [Cloud storage](https://docs.databricks.com/gcp/en/lakewatch/ingest-data/ingestion-methods/cloud-storage.md).

## Parsed schema and observables

CloudTrail delivers three types of objects to Amazon S3, and Lakewatch provides a built-in parser for each. Attach the parser that matches the objects your datasource ingests:

* **`aws_cloudtrail`**: Standard CloudTrail management, data, and network activity events.
* **`aws_cloudtrail_digest`**: Digest files, which list the log files delivered in the previous hour with hash values for log-file integrity validation.
* **`aws_cloudtrail_insight`**: CloudTrail Insights events, which record unusual API call-rate activity.

Every parsed table also carries the Lakewatch-managed columns:

* `lw_id`: A non-null string Lakewatch uses as the primary key, supporting deduplication across incremental reads.
* `time`: A non-null event timestamp.
* `lw_meta`: Standard Lakewatch processing metadata.
* `lw_observables`: Values extracted from fields marked as security observables in the parser.

See [Parser reference](https://docs.databricks.com/gcp/en/lakewatch/ingest-data/custom-logs/parser-reference.md).

### `aws_cloudtrail`

Schematizes standard CloudTrail events. Parses `time` from the `eventTime` field.

**Parsed table schema**

The `aws_cloudtrail` parser writes the following columns (generated from the parser definition):

| Column                         | Data type        |
| ------------------------------ | ---------------- |
| `time`                         | `TIMESTAMP`      |
| `additionalEventData`          | `VARIANT`        |
| `apiVersion`                   | `STRING`         |
| `awsRegion`                    | `STRING`         |
| `errorCode`                    | `STRING`         |
| `errorMessage`                 | `STRING`         |
| `eventID`                      | `STRING`         |
| `eventName`                    | `STRING`         |
| `eventSource`                  | `STRING`         |
| `eventType`                    | `STRING`         |
| `eventVersion`                 | `STRING`         |
| `managementEvent`              | `BOOLEAN`        |
| `readOnly`                     | `BOOLEAN`        |
| `recipientAccountId`           | `STRING`         |
| `requestID`                    | `STRING`         |
| `requestParameters`            | `VARIANT`        |
| `resources`                    | `ARRAY<VARIANT>` |
| `responseElements`             | `VARIANT`        |
| `serviceEventDetails`          | `VARIANT`        |
| `sharedEventID`                | `STRING`         |
| `sourceIPAddress`              | `STRING`         |
| `userAgent`                    | `STRING`         |
| `userIdentity`                 | `VARIANT`        |
| `vpcEndpointId`                | `STRING`         |
| `eventCategory`                | `STRING`         |
| `sessionCredentialFromConsole` | `BOOLEAN`        |
| `edgeDeviceDetails`            | `VARIANT`        |
| `tlsDetails`                   | `VARIANT`        |
| `addendum`                     | `VARIANT`        |

**Parser observables**

The parser extracts the following fields into `lw_observables` (generated from the parser definition):

| Field                                                               | Observable       |
| ------------------------------------------------------------------- | ---------------- |
| `recipientAccountId`                                                | `aws_account_id` |
| `resources[].arn`                                                   | `aws_arn`        |
| `resources[].accountId`                                             | `aws_account_id` |
| `sourceIPAddress`                                                   | `hostname`       |
| `userIdentity.principalId`                                          | `actor_id`       |
| `userIdentity.arn`                                                  | `aws_arn`        |
| `userIdentity.accountId`                                            | `aws_account_id` |
| `userIdentity.accessKeyId`                                          | `trace_id`       |
| `userIdentity.userName`                                             | `username`       |
| `userIdentity.sessionContext.sessionIssuer.principalId`             | `actor_id`       |
| `userIdentity.sessionContext.sessionIssuer.arn`                     | `aws_arn`        |
| `userIdentity.sessionContext.sessionIssuer.accountId`               | `aws_account_id` |
| `userIdentity.sessionContext.sessionIssuer.userName`                | `username`       |
| `userIdentity.sessionContext.webIdFederationData.federatedProvider` | `aws_arn`        |
| `userIdentity.onBehalfOf.identityStoreArn`                          | `aws_arn`        |
| `userIdentity.inScopeOf.sourceArn`                                  | `aws_arn`        |
| `userIdentity.inScopeOf.sourceAccount`                              | `aws_account_id` |

The following `VARIANT` fields are scanned for observables by matching nested key names. The table lists the observable types extracted from each:

| Field                                                        | Observable types scanned                                                                                           |
| ------------------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------ |
| `additionalEventData`                                        | `actor_id`, `aws_account_id`, `aws_arn`, `aws_instance_id`, `domain`, `ip`, `resource_tag`, `trace_id`, `username` |
| `requestParameters`                                          | `actor_id`, `aws_account_id`, `aws_arn`, `aws_instance_id`, `domain`, `ip`, `resource_tag`, `trace_id`, `username` |
| `responseElements`                                           | `actor_id`, `aws_account_id`, `aws_arn`, `aws_instance_id`, `domain`, `ip`, `resource_tag`, `trace_id`, `username` |
| `serviceEventDetails`                                        | `actor_id`, `aws_account_id`, `aws_arn`, `aws_instance_id`, `domain`, `ip`, `resource_tag`, `trace_id`, `username` |
| `userIdentity.sessionContext.webIdFederationData.attributes` | `actor_id`, `aws_account_id`, `aws_arn`, `aws_instance_id`, `domain`, `ip`, `resource_tag`, `trace_id`, `username` |

### `aws_cloudtrail_digest`

Schematizes CloudTrail digest files, which support log-file integrity validation. Parses `time` from the `digestEndTime` field.

**Parsed table schema**

The `aws_cloudtrail_digest` parser writes the following columns (generated from the parser definition):

| Column                        | Data type        |
| ----------------------------- | ---------------- |
| `time`                        | `TIMESTAMP`      |
| `awsAccountId`                | `STRING`         |
| `digestStartTime`             | `TIMESTAMP`      |
| `digestS3Bucket`              | `STRING`         |
| `digestS3Object`              | `STRING`         |
| `newestEventTime`             | `TIMESTAMP`      |
| `oldestEventTime`             | `TIMESTAMP`      |
| `previousDigestS3Bucket`      | `STRING`         |
| `previousDigestS3Object`      | `STRING`         |
| `previousDigestHashValue`     | `STRING`         |
| `previousDigestHashAlgorithm` | `STRING`         |
| `previousDigestSignature`     | `STRING`         |
| `digestPublicKeyFingerprint`  | `STRING`         |
| `digestSignatureAlgorithm`    | `STRING`         |
| `logFiles`                    | `ARRAY<VARIANT>` |

**Parser observables**

The parser extracts the following fields into `lw_observables` (generated from the parser definition):

| Field                     | Observable       |
| ------------------------- | ---------------- |
| `awsAccountId`            | `aws_account_id` |
| `previousDigestHashValue` | `hash`           |
| `logFiles[].hashValue`    | `hash`           |

### `aws_cloudtrail_insight`

Schematizes CloudTrail Insights events, which record unusual API call-rate activity. Parses `time` from the `eventTime` field.

**Parsed table schema**

The `aws_cloudtrail_insight` parser writes the following columns (generated from the parser definition):

| Column               | Data type   |
| -------------------- | ----------- |
| `time`               | `TIMESTAMP` |
| `eventVersion`       | `STRING`    |
| `awsRegion`          | `STRING`    |
| `eventID`            | `STRING`    |
| `eventType`          | `STRING`    |
| `recipientAccountId` | `STRING`    |
| `sharedEventID`      | `STRING`    |
| `insightDetails`     | `VARIANT`   |
| `eventCategory`      | `STRING`    |

**Parser observables**

The parser extracts the following fields into `lw_observables` (generated from the parser definition):

| Field                | Observable       |
| -------------------- | ---------------- |
| `recipientAccountId` | `aws_account_id` |
| `sharedEventID`      | `trace_id`       |
