Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
140 changes: 140 additions & 0 deletions aigw/product/observability/exporting-data.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
---
title: "Exporting Data"
description: "Access audit logs, export logs, and download exported logs from Strata Cloud Manager (SCM) or the API."
---

This page covers three tasks. Each has an app flow and an API flow.

1. [Access audit logs](#1-access-audit-logs): see who changed what in your organisation
2. [Export logs](#2-export-logs): create an export job for your request logs
3. [Download exported logs](#3-download-exported-logs): get the finished file

## 1. Access audit logs

Audit logs record administrative changes: who made a change, to which resource, and when.

### Access in SCM

In SCM, open **Log Viewer** and select **Common/Audit** from the drop-down. See [Audit Logs](/aigw/product/enterprise-offering/audit-logs) for what each entry contains.

### Filters

Narrow the results with any of these filters:

| Filter | Description |
|---|---|
| **Time range** | Period to search |
| **Method** | HTTP method: `POST`, `PUT`, or `DELETE` |
| **Request ID** | A specific request |
| **Resource type** | Type of resource affected, such as workspaces, API keys, integrations, configs, or guardrails |
| **Action** | Create, update, delete, publish, export, rotate, manage, or duplicate |
| **Response status** | HTTP status code |
| **Workspace** | A specific workspace |
| **User** | The user or API key that made the change |
| **Client IP** | Originating IP address |
| **Country** | Originating country |

In SCM, use the filters in Log Viewer.

### Access with the API

Audit logs are available in SCM. An audit logs endpoint is not published in the Prisma AIRS AI Gateway API reference.

## 2. Export logs

Exports run as jobs. Each job writes your request logs for a time range to a JSONL file, up to 50,000 logs per job.

### Export in SCM

<Steps>
<Step title="Open Exports">
Go to **Exports** on the main sidebar and click **Request Data**.
</Step>
<Step title="Configure the export">
Set the **Time Range**, the **Logs Limits** (maximum number of logs or a custom offset), and the **Requested Fields** to include.
</Step>
<Step title="Request and start the export">
Click **Request Export**. The job appears in the exports list with the status **Draft**. Click **Start** to run it.
</Step>
</Steps>

### Export with the API

Create the export job, then start it. The job runs asynchronously.

<Steps>
<Step title="Create the export">
`POST /v1/logs/exports` with a time range and the fields to export. The response contains the export `id`.

```bash
curl -X POST "https://aigw.portkey.ai/v1/logs/exports" \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filters": {
"created_at": {
"gte": "2026-11-01T00:00:00Z",
"lte": "2026-11-18T23:59:59Z"
}
},
"requested_data": ["id", "created_at", "ai_model", "total_units", "cost", "response_status_code"]
}'
```
</Step>
<Step title="Start the export">
`POST /v1/logs/exports/{export_id}/start`

```bash
curl -X POST "https://aigw.portkey.ai/v1/logs/exports/EXPORT_ID/start" \
-H "Authorization: Bearer YOUR_API_KEY"
```
</Step>
</Steps>

For the full list of fields, restrictions on exportable fields, and a complete script, see [Logs Export](/aigw/product/observability/logs-export).

## 3. Download exported logs

### Download in SCM

<Steps>
<Step title="Wait for the export to finish">
Open **Exports** on the main sidebar. The status changes to **Success** when the job is done. If it shows **Failure**, click **Start Again** to retry.
</Step>
<Step title="Download the file">
Click **Download** next to the completed export. The file is in JSONL format, one log entry per line.
</Step>
</Steps>

### Download with the API

<Steps>
<Step title="Check the export status">
`GET /v1/logs/exports/{export_id}`. Repeat until `status` is `success`. A status of `failure` means the job failed.

```bash
curl "https://aigw.portkey.ai/v1/logs/exports/EXPORT_ID" \
-H "Authorization: Bearer YOUR_API_KEY"
```
</Step>
<Step title="Get the download URL">
`GET /v1/logs/exports/{export_id}/download` returns a signed URL.

```bash
curl "https://aigw.portkey.ai/v1/logs/exports/EXPORT_ID/download" \
-H "Authorization: Bearer YOUR_API_KEY"
```
</Step>
<Step title="Download the file">
```bash
curl -o logs_export.jsonl "SIGNED_DOWNLOAD_URL"
```
</Step>
</Steps>

## Related

<CardGroup cols={2}>
<Card title="Audit Logs" icon="clipboard-list" href="/aigw/product/enterprise-offering/audit-logs" />
<Card title="Logs Export" icon="file-export" href="/aigw/product/observability/logs-export" />
</CardGroup>
2 changes: 2 additions & 0 deletions docs.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"product/observability/metadata",
"product/observability/filters",
"product/observability/logs-export",
"product/observability/exporting-data",
"product/observability/cost-management",
"product/observability/budget-limits",
"product/observability/auto-instrumentation"
Expand Down Expand Up @@ -1627,6 +1628,7 @@
"aigw/product/observability/metadata",
"aigw/product/observability/filters",
"aigw/product/observability/logs-export",
"aigw/product/observability/exporting-data",
"aigw/product/observability/cost-management",
"aigw/product/observability/auto-instrumentation",
"aigw/product/administration/configuring-request-logging",
Expand Down
163 changes: 163 additions & 0 deletions product/observability/exporting-data.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,163 @@
---
title: "Exporting Data"
description: "Access audit logs, export logs, and download exported logs from the Portkey app or the API."
---

This page covers three tasks. Each has an app flow and an API flow.

1. [Access audit logs](#1-access-audit-logs): see who changed what in your organisation
2. [Export logs](#2-export-logs): create an export job for your request logs
3. [Download exported logs](#3-download-exported-logs): get the finished file

## 1. Access audit logs

Audit logs record administrative changes: who made a change, to which resource, and when.

### Access in the app

Go to **Admin Settings > Audit Logs**. Audit logs are collected automatically across all workspaces. See [Audit Logs](/product/enterprise-offering/audit-logs) for what each entry contains.

### Filters

Narrow the results with any of these filters:

| Filter | Description |
|---|---|
| **Time range** | Period to search |
| **Method** | HTTP method: `POST`, `PUT`, or `DELETE` |
| **Request ID** | A specific request |
| **Resource type** | Type of resource affected, such as workspaces, API keys, integrations, configs, guardrails, or prompts |
| **Action** | Create, update, delete, publish, export, rotate, manage, or duplicate |
| **Response status** | HTTP status code |
| **Workspace** | A specific workspace |
| **User** | The user or API key that made the change |
| **Client IP** | Originating IP address |
| **Country** | Originating country |

In the app, use the filters on the Audit Logs page.

### Access with the API

Call [`GET /audit-logs`](/api-reference/admin-api/control-plane/audit-logs/list-audit-logs). `start_time`, `end_time`, and `organisation_id` are required. `start_time` and `end_time` are ISO 8601 timestamps.

```bash
curl "https://api.portkey.ai/v1/audit-logs?start_time=2026-11-01T00:00:00Z&end_time=2026-11-18T23:59:59Z&organisation_id=YOUR_ORGANISATION_ID" \
-H "x-portkey-api-key: YOUR_PORTKEY_API_KEY"
```

Add any of these query parameters to filter the results:

| Parameter | Filters by |
|---|---|
| `method` | `POST`, `PUT`, or `DELETE` |
| `uri` | URI path |
| `request_id` | Request ID |
| `user_id` | User ID |
| `user_type` | `user` or `api_key` |
| `workspace_id` | Workspace |
| `response_status_code` | HTTP status code |
| `resource_type` | Resource type |
| `action` | Action |
| `client_ip` | Client IP address |
| `country` | Country |

Results are paginated. Use `current_page` and `page_size` (maximum 100) to page through them.

## 2. Export logs

Exports run as jobs. Each job writes your request logs for a time range to a JSONL file, up to 50,000 logs per job.

### Export in the app

<Steps>
<Step title="Open Exports">
Go to **Exports** on the main sidebar and click **Request Data**.
</Step>
<Step title="Configure the export">
Set the **Time Range**, the **Logs Limits** (maximum number of logs or a custom offset), and the **Requested Fields** to include.
</Step>
<Step title="Request and start the export">
Click **Request Export**. The job appears in the exports list with the status **Draft**. Click **Start** to run it.
</Step>
</Steps>

### Export with the API

Create the export job, then start it. The job runs asynchronously.

<Steps>
<Step title="Create the export">
[`POST /v1/logs/exports`](/api-reference/admin-api/data-plane/logs/log-exports-beta/create-a-log-export) with a time range and the fields to export. The response contains the export `id`.

```bash
curl -X POST "https://api.portkey.ai/v1/logs/exports" \
-H "x-portkey-api-key: YOUR_PORTKEY_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"filters": {
"created_at": {
"gte": "2026-11-01T00:00:00Z",
"lte": "2026-11-18T23:59:59Z"
}
},
"requested_data": ["id", "created_at", "ai_model", "total_units", "cost", "response_status_code"]
}'
```
</Step>
<Step title="Start the export">
[`POST /v1/logs/exports/{export_id}/start`](/api-reference/admin-api/data-plane/logs/log-exports-beta/start-a-log-export)

```bash
curl -X POST "https://api.portkey.ai/v1/logs/exports/EXPORT_ID/start" \
-H "x-portkey-api-key: YOUR_PORTKEY_API_KEY"
```
</Step>
</Steps>

For the full list of fields, restrictions on exportable fields, and a complete script, see [Logs Export](/product/observability/logs-export).

## 3. Download exported logs

### Download in the app

<Steps>
<Step title="Wait for the export to finish">
Open **Exports** on the main sidebar. The status changes to **Success** when the job is done. If it shows **Failure**, click **Start Again** to retry.
</Step>
<Step title="Download the file">
Click **Download** next to the completed export. The file is in JSONL format, one log entry per line.
</Step>
</Steps>

### Download with the API

<Steps>
<Step title="Check the export status">
[`GET /v1/logs/exports/{export_id}`](/api-reference/admin-api/data-plane/logs/log-exports-beta/retrieve-a-log-export). Repeat until `status` is `success`. A status of `failure` means the job failed.

```bash
curl "https://api.portkey.ai/v1/logs/exports/EXPORT_ID" \
-H "x-portkey-api-key: YOUR_PORTKEY_API_KEY"
```
</Step>
<Step title="Get the download URL">
[`GET /v1/logs/exports/{export_id}/download`](/api-reference/admin-api/data-plane/logs/log-exports-beta/download-a-log-export) returns a signed URL.

```bash
curl "https://api.portkey.ai/v1/logs/exports/EXPORT_ID/download" \
-H "x-portkey-api-key: YOUR_PORTKEY_API_KEY"
```
</Step>
<Step title="Download the file">
```bash
curl -o logs_export.jsonl "SIGNED_DOWNLOAD_URL"
```
</Step>
</Steps>

## Related

<CardGroup cols={2}>
<Card title="Audit Logs" icon="clipboard-list" href="/product/enterprise-offering/audit-logs" />
<Card title="Logs Export" icon="file-export" href="/product/observability/logs-export" />
</CardGroup>
Loading