> For the complete documentation index, see [llms.txt](https://ai-security-docs.akto.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ai-security-docs.akto.io/akto-atlas-agentic-ai-security-for-employee-endpoints/ai-agent-activity/export-traces-to-s3.md). Agents can also search and read this documentation through its [MCP server](https://ai-security-docs.akto.io/~gitbook/mcp).

# Export Traces to Amazon S3

## Overview

Akto Atlas can export your [Traces](https://ai-security-docs.akto.io/akto-atlas-agentic-ai-security-for-employee-endpoints/ai-agent-activity/traces.md) to an Amazon S3 bucket in your own AWS account, in **OpenTelemetry (OTLP JSON)** format. Use the export to keep a long-term copy of AI activity, or to feed it into your SIEM, data lake, or observability tools.

Each exported trace includes:

* Guardrail results: whether a guardrail was violated, and the policy, rule, action, reason, and severity
* The model used
* Token usage (input and output)
* The user, device, application, and session
* The full prompt and response

When you enable the export, Akto first sends your **existing trace history**, oldest first, and then keeps sending new traces every **5 minutes**.

{% hint style="info" %}
Atlas Log Export to S3 is available for Akto SaaS accounts and is enabled on request. To enable it, raise a [support](https://ai-security-docs.akto.io/troubleshooting/support.md) ticket. It is not available for self-hosted deployments.
{% endhint %}

## Prerequisites

Before setting up the export, make sure you have:

* An **Amazon S3 bucket** in your AWS account to receive the traces
* The bucket's **AWS region** (for example `us-east-1`)
* Permission to create an **IAM role** or an **IAM user** in that AWS account
* The export enabled for your account (see above)

## Give Akto Access to Your Bucket

Akto supports two ways to write to your bucket. Choose one.

{% tabs %}
{% tab title="IAM role (recommended)" %}
Create an IAM role in your AWS account that Akto assumes when it writes to your bucket. No long-lived credentials are shared with Akto.

You need two values:

<table><thead><tr><th width="200">Value</th><th>Where to get it</th></tr></thead><tbody><tr><td><strong>Akto AWS account ID</strong></td><td>Shared by Akto support in your help desk ticket</td></tr><tr><td><strong>External ID</strong></td><td>Your Akto account ID, shown in the connector (see <a href="#set-up-the-export-in-akto">Set Up the Export in Akto</a>)</td></tr></tbody></table>

1. In the AWS IAM console, create a role with the following **trust policy**:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": { "AWS": "arn:aws:iam::<AKTO_AWS_ACCOUNT_ID>:root" },
      "Action": "sts:AssumeRole",
      "Condition": { "StringEquals": { "sts:ExternalId": "<YOUR_AKTO_ACCOUNT_ID>" } }
    }
  ]
}
```

2. Attach a **permissions policy** that allows writing to your bucket:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::<YOUR_BUCKET>/<YOUR_PREFIX>/*"
    }
  ]
}
```

3. Copy the **role ARN** (for example `arn:aws:iam::123456789012:role/akto-atlas-export`).

{% hint style="info" %}
The External ID makes sure only your Akto account can use this role.
{% endhint %}
{% endtab %}

{% tab title="Access keys" %}
Create an IAM user that can only write to your bucket, and give Akto its access keys.

1. In the AWS IAM console, create an IAM user and attach the following policy:

```json
{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": "s3:PutObject",
      "Resource": "arn:aws:s3:::<YOUR_BUCKET>/<YOUR_PREFIX>/*"
    }
  ]
}
```

2. Create an **access key** for the user, and copy the **Access Key ID** and **Secret Access Key**.

{% hint style="warning" %}
Access keys do not expire on their own. Rotate them regularly, and update them in Akto when you do.
{% endhint %}
{% endtab %}
{% endtabs %}

{% hint style="info" %}
If you don't use a key prefix, use `arn:aws:s3:::<YOUR_BUCKET>/*` as the resource.

If your bucket uses **SSE-KMS** encryption, also allow `kms:GenerateDataKey` on the bucket's KMS key, in the role or user policy and in the key policy.
{% endhint %}

## Set Up the Export in Akto

{% stepper %}
{% step %}
**Open the connector**

1. Open the **Akto Atlas** dashboard.
2. Go to **Connectors**.
3. Go to **Log Export**.
4. Select **Atlas Log Export to S3** and click **Connect**.
   {% endstep %}

{% step %}
**Enter your bucket details**

* **S3 Bucket Name**: the bucket that receives the traces
* **AWS Region**: the bucket's region, for example `us-east-1`
* **Key Prefix** (optional): the folder inside the bucket, for example `akto/atlas`
  {% endstep %}

{% step %}
**Choose how Akto authenticates**

Under **Authentication**, select the option you set up in AWS:

* **IAM role (recommended)**: enter the **IAM Role ARN**. The connector shows the **External ID** to use in your role's trust policy.

<div data-with-frame="true"><figure><img src="https://1895868029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkpBG2Nfd5ZbNmahr8W6H%2Fuploads%2Fgit-blob-7a8c11398cce2e6aff98c9f1d31dd3edce6835a2%2Fatlas-s3-export-iam-role.png?alt=media" alt="Atlas Log Export to S3 connector with IAM role authentication" width="563"><figcaption></figcaption></figure></div>

* **Access keys**: enter the **Access Key ID** and **Secret Access Key**.

<div data-with-frame="true"><figure><img src="https://1895868029-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FkpBG2Nfd5ZbNmahr8W6H%2Fuploads%2Fgit-blob-1bd75959c835ca37a933e0c943462b474440db3f%2Fatlas-s3-export-access-keys.png?alt=media" alt="Atlas Log Export to S3 connector with access key authentication" width="563"><figcaption></figcaption></figure></div>
{% endstep %}

{% step %}
**Save**

Click **Save**. The first files appear in your bucket within a few minutes.
{% endstep %}
{% endstepper %}

## How Traces Are Delivered

<table><thead><tr><th width="200">Behaviour</th><th>Details</th></tr></thead><tbody><tr><td><strong>History</strong></td><td>All traces stored in Akto are sent, oldest first, in batches every 5 minutes, so a large history does not arrive all at once</td></tr><tr><td><strong>New traces</strong></td><td>Sent every 5 minutes, about 15–20 minutes after they happen</td></tr><tr><td><strong>Order</strong></td><td>Files are written in time order; file names sort oldest to newest</td></tr><tr><td><strong>Failures</strong></td><td>If a write fails (for example, missing permissions), Akto retries on the next run from the same point. No traces are skipped or duplicated</td></tr><tr><td><strong>Scope</strong></td><td>Only Atlas traces from your account are exported</td></tr></tbody></table>

## File Format

Traces are written as gzip-compressed OpenTelemetry JSON (`ExportTraceServiceRequest`) files, in the same folder layout used by the OpenTelemetry Collector's S3 exporter:

```
<prefix>/year=YYYY/month=MM/day=DD/hour=HH/minute=mm/traces_<timestamp>_<page>.json.gz
```

Each file holds up to 100 traces, grouped by application, which appears as the OpenTelemetry `service.name`. Each trace is a span with these attributes:

<table><thead><tr><th width="260">Attribute</th><th>Description</th></tr></thead><tbody><tr><td><code>gen_ai.request.model</code></td><td>The model used</td></tr><tr><td><code>gen_ai.usage.input_tokens</code></td><td>Input (prompt) tokens</td></tr><tr><td><code>gen_ai.usage.output_tokens</code></td><td>Output (completion) tokens</td></tr><tr><td><code>user.name</code></td><td>The user who made the request</td></tr><tr><td><code>session.id</code></td><td>The session the trace belongs to</td></tr><tr><td><code>host.id</code></td><td>The device the request came from</td></tr><tr><td><code>akto.guardrail.violated</code></td><td>Whether a guardrail was violated. Present only when guardrails ran on the trace</td></tr><tr><td><code>akto.guardrail.action</code>, <code>.policy</code>, <code>.rule</code>, <code>.reason</code>, <code>.severity</code></td><td>Details of the guardrail result</td></tr><tr><td><code>akto.request.payload</code></td><td>The prompt</td></tr><tr><td><code>akto.response.payload</code></td><td>The response</td></tr><tr><td><code>akto.trace_id</code>, <code>akto.span_id</code></td><td>The trace and span IDs as shown in Akto</td></tr></tbody></table>

## Edit or Remove the Export

* **Edit**: open the connector, change the details, and click **Save**. The export continues from where it left off. When using access keys, leave **Secret Access Key** blank to keep the saved one.
* **Remove**: open the connector and click **Remove**. Akto stops sending traces. Files already in your bucket are not deleted.

## Troubleshooting

<table><thead><tr><th width="240">Issue</th><th>What to check</th></tr></thead><tbody><tr><td><strong>Log Export is not shown in Connectors</strong></td><td>The export is not enabled for your account yet. Raise a support ticket</td></tr><tr><td><strong>No files in the bucket</strong></td><td>Check that the bucket name, region, and prefix are correct, and that your account has Atlas traces</td></tr><tr><td><strong>Access denied</strong></td><td>IAM role: check the trust policy uses the Akto AWS account ID and your External ID. Both options: check the policy allows <code>s3:PutObject</code> on the bucket and prefix</td></tr><tr><td><strong>Bucket uses SSE-KMS</strong></td><td>Allow <code>kms:GenerateDataKey</code> on the bucket's KMS key</td></tr></tbody></table>
