# AWS CloudTrail

> Inspect CloudTrail event history, trails, event data stores, queries and imports.

App · 20 actions. Web page: https://docs.lodol.com/docs/integrations/aws-cloudtrail

## Actions

### Describe query

Get the details of a CloudTrail Lake query by its ID or alias, including its SQL statement, status, run time and how many events it scanned.

**Inputs**

- Event data store (`event_data_store`, text): Event data store.
- Query (`query_id`, text): Query id.
- Query alias (`query_alias`, text): Query alias.
- Refresh id (`refresh_id`, text): Refresh id.
- Event data store owner account id (`event_data_store_owner_account_id`, text): Event data store owner account id.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "DeliveryS3Uri": "example",
    "DeliveryStatus": "SUCCESS",
    "ErrorMessage": "example",
    "EventDataStoreOwnerAccountId": "example",
    "Prompt": "example",
    "QueryId": "example",
    "QueryStatistics": {
      "BytesScanned": 1,
      "CreationTime": "example",
      "EventsMatched": 1,
      "EventsScanned": 1,
      "ExecutionTimeInMillis": 1
    },
    "QueryStatus": "QUEUED",
    "QueryString": "example"
  }
}
```

### Describe trails

Get the settings of the trails you name, or of every trail in the region, including the S3 bucket, log file validation and whether each trail is multi-region.

**Inputs**

- Trail name list (`trail_name_list`, list): Trail name list.
- Include shadow trails (`include_shadow_trails`, true/false): Include shadow trails.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "trailList": []
  }
}
```

### Get channel

Get one CloudTrail Lake channel by its name or ARN, including its source, destinations and ingestion status.

**Inputs**

- Channel (`channel`, text, required): Channel.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "ChannelArn": "example",
    "Destinations": [],
    "IngestionStatus": {
      "LatestIngestionAttemptEventID": "example",
      "LatestIngestionAttemptTime": "example",
      "LatestIngestionErrorCode": "example",
      "LatestIngestionSuccessEventID": "example",
      "LatestIngestionSuccessTime": "example"
    },
    "Name": "example",
    "Source": "example",
    "SourceConfig": {
      "AdvancedEventSelectors": [],
      "ApplyToAllRegions": false
    }
  }
}
```

### Get event configuration

Get the event configuration of a trail or event data store, such as the maximum event size it accepts and any context keys it adds.

**Inputs**

- Trail name (`trail_name`, text): Trail name.
- Event data store (`event_data_store`, text): Event data store.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "AggregationConfigurations": [],
    "ContextKeySelectors": [],
    "EventDataStoreArn": "example",
    "MaxEventSize": "Standard",
    "TrailARN": "example"
  }
}
```

### Get event data store

Get one CloudTrail Lake event data store by its name or ARN, including its retention period, status and advanced event selectors.

**Inputs**

- Event data store (`event_data_store`, text, required): Event data store.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "AdvancedEventSelectors": [],
    "BillingMode": "EXTENDABLE_RETENTION_PRICING",
    "CreatedTimestamp": "example",
    "EventDataStoreArn": "example",
    "FederationRoleArn": "example",
    "FederationStatus": "ENABLING",
    "KmsKeyId": "example",
    "MultiRegionEnabled": false,
    "Name": "example",
    "OrganizationEnabled": false,
    "PartitionKeys": [],
    "RetentionPeriod": 1,
    "Status": "CREATED",
    "TerminationProtectionEnabled": false,
    "UpdatedTimestamp": "example"
  }
}
```

### Get event selectors

Get the event selectors of a trail by its name or ARN, showing which management and data events it records.

**Inputs**

- Trail name (`trail_name`, text, required): Trail name.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "AdvancedEventSelectors": [],
    "EventSelectors": [],
    "TrailARN": "example"
  }
}
```

### Get import

Get one CloudTrail Lake import by its ID, including its source S3 location, destinations, status and how many events it has copied.

**Inputs**

- Import (`import_id`, text, required): Import id.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "CreatedTimestamp": "example",
    "Destinations": [],
    "EndEventTime": "example",
    "ImportId": "example",
    "ImportSource": {
      "S3": {
        "S3BucketAccessRoleArn": "example",
        "S3BucketRegion": "example",
        "S3LocationUri": "example"
      }
    },
    "ImportStatistics": {
      "EventsCompleted": 1,
      "FailedEntries": 1,
      "FilesCompleted": 1,
      "PrefixesCompleted": 1,
      "PrefixesFound": 1
    },
    "ImportStatus": "INITIALIZING",
    "StartEventTime": "example",
    "UpdatedTimestamp": "example"
  }
}
```

### Get insight selectors

Get the Insights types, such as unusual API call rates, that a trail or event data store is set to detect.

**Inputs**

- Trail name (`trail_name`, text): Trail name.
- Event data store (`event_data_store`, text): Event data store.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "EventDataStoreArn": "example",
    "InsightSelectors": [],
    "InsightsDestination": "example",
    "TrailARN": "example"
  }
}
```

### Get query results

Get the rows returned by a finished CloudTrail Lake query, by its query ID, along with the query's status and statistics.

**Inputs**

- Event data store (`event_data_store`, text): Event data store.
- Query (`query_id`, text, required): Query id.
- Next token (`next_token`, text): Next token.
- Max query results (`max_query_results`, number): Max query results. From 1 to 1000.
- Event data store owner account id (`event_data_store_owner_account_id`, text): Event data store owner account id.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "ErrorMessage": "example",
    "NextToken": "example",
    "QueryResultRows": [],
    "QueryStatistics": {
      "BytesScanned": 1,
      "ResultsCount": 1,
      "TotalResultsCount": 1
    },
    "QueryStatus": "QUEUED"
  }
}
```

### Get resource policy

Get the resource-based policy attached to a CloudTrail Lake channel or event data store, by its ARN.

**Inputs**

- Resource arn (`resource_arn`, text, required): Resource arn.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "DelegatedAdminResourcePolicy": "example",
    "ResourceArn": "example",
    "ResourcePolicy": "example"
  }
}
```

### Get trail

Get one trail's settings by its name or ARN, such as its S3 bucket, CloudWatch Logs group and whether it covers all regions.

**Inputs**

- Name (`name`, text, required): Name.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "Trail": {
      "CloudWatchLogsLogGroupArn": "example",
      "CloudWatchLogsRoleArn": "example",
      "HasCustomEventSelectors": false,
      "HasInsightSelectors": false,
      "HomeRegion": "example",
      "IncludeGlobalServiceEvents": false,
      "IsMultiRegionTrail": false,
      "IsOrganizationTrail": false,
      "KmsKeyId": "example",
      "LogFileValidationEnabled": false,
      "Name": "example",
      "RecursiveLogging": false,
      "S3BucketName": "example",
      "S3KeyPrefix": "example",
      "SnsTopicARN": "example",
      "SnsTopicName": "example",
      "TrailARN": "example"
    }
  }
}
```

### Get trail status

Get whether a trail is logging, by its name or ARN, with the times of its last delivery to S3 and any recent delivery errors.

**Inputs**

- Name (`name`, text, required): Name.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "IsLogging": false,
    "LatestCloudWatchLogsDeliveryError": "example",
    "LatestCloudWatchLogsDeliveryTime": "example",
    "LatestDeliveryAttemptSucceeded": "example",
    "LatestDeliveryAttemptTime": "example",
    "LatestDeliveryError": "example",
    "LatestDeliveryTime": "example",
    "LatestDigestDeliveryError": "example",
    "LatestDigestDeliveryTime": "example",
    "LatestNotificationAttemptSucceeded": "example",
    "LatestNotificationAttemptTime": "example",
    "LatestNotificationError": "example",
    "LatestNotificationTime": "example",
    "StartLoggingTime": "example",
    "StopLoggingTime": "example",
    "TimeLoggingStarted": "example",
    "TimeLoggingStopped": "example"
  }
}
```

### List channels

List the CloudTrail Lake channels that bring events in from outside AWS, with each channel's name and ARN.

**Inputs**

- Max results (`max_results`, number): Max results. From 1 to 1000.
- Next token (`next_token`, text): Next token.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "Channels": [],
    "NextToken": "example"
  }
}
```

### List event data stores

List the CloudTrail Lake event data stores in your account, with each one's name, ARN and status.

**Inputs**

- Next token (`next_token`, text): Next token.
- Max results (`max_results`, number): Max results. From 1 to 1000.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "EventDataStores": [],
    "NextToken": "example"
  }
}
```

### List import failures

List the failures of a CloudTrail Lake import, by its import ID, with the S3 location and error message of each failed file.

**Inputs**

- Import (`import_id`, text, required): Import id.
- Max results (`max_results`, number): Max results. From 1 to 1000.
- Next token (`next_token`, text): Next token.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "Failures": [],
    "NextToken": "example"
  }
}
```

### List imports

List the imports of trail events into CloudTrail Lake, optionally filtered by destination event data store and import status.

**Inputs**

- Max results (`max_results`, number): Max results. From 1 to 1000.
- Destination (`destination`, text): Destination.
- Import status (`import_status`, text): Import status. One of: `INITIALIZING`, `IN_PROGRESS` (In progress), `FAILED`, `STOPPED`, `COMPLETED`.
- Next token (`next_token`, text): Next token.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "Imports": [],
    "NextToken": "example"
  }
}
```

### List queries

List the CloudTrail Lake queries run against an event data store, optionally filtered by time range and query status. Returns each query's ID, status and start time.

**Inputs**

- Event data store (`event_data_store`, text, required): Event data store.
- Next token (`next_token`, text): Next token.
- Max results (`max_results`, number): Max results. From 1 to 1000.
- Start time (`start_time`, date and time): Start time.
- End time (`end_time`, date and time): End time.
- Query status (`query_status`, text): Query status. One of: `QUEUED`, `RUNNING`, `FINISHED`, `FAILED`, `CANCELLED`, `TIMED_OUT` (Timed out).

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "NextToken": "example",
    "Queries": []
  }
}
```

### List tags

Get the tags on the trails, event data stores or channels you name by ARN.

**Inputs**

- Resource id list (`resource_id_list`, list, required): Resource id list.
- Next token (`next_token`, text): Next token.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "NextToken": "example",
    "ResourceTagList": []
  }
}
```

### List trails

List the trails in your account and region, with each trail's name, ARN and home region.

**Inputs**

- Next token (`next_token`, text): Next token.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "NextToken": "example",
    "Trails": []
  }
}
```

### Lookup events

Search the management and Insights events CloudTrail recorded in the last 90 days, optionally filtered by one attribute such as user name or event name and by a time range. Returns the matching events, newest first.

**Inputs**

- Lookup attributes (`lookup_attributes`, list): Lookup attributes.
- Start time (`start_time`, date and time): Start time.
- End time (`end_time`, date and time): End time.
- Event category (`event_category`, text): Event category. One of: `insight`.
- Max results (`max_results`, number): Max results. From 1 to 50.
- Next token (`next_token`, text): Next token.

**Outputs**

- `data` (object): AWS Cloud Trail response data.

**Example output**

```json
{
  "data": {
    "Events": [],
    "NextToken": "example"
  }
}
```
