> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nebius.com/llms.txt
> Use this file to discover all available pages before exploring further.

# How to export audit events to Object Storage

*Audit event export* lets you deliver [audit events](https://docs.nebius.com/audit-logs/events/view.md) for a fixed time range to an [Object Storage bucket](https://docs.nebius.com/object-storage/overview.md#buckets). Exports are one-time and run asynchronously, writing files directly to the bucket. This is useful for long-term retention, processing data in external tools and [data portability](https://docs.nebius.com/overview/data-portability.md). After the export completes, you can download the exported objects from the bucket to store them locally or move them to a different provider.

## Prerequisites

> [tab] CLI
>
> 1. [Install and configure](https://docs.nebius.com/cli/install.md) the Nebius AI Cloud CLI.
> 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` or `auditlogs.audit-event-exporter` role within your tenant. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.
> 3. Make sure that you have the `storage.uploader` role for the destination Object Storage bucket.
> 4. Identify the regions to export audit events from.

> [tab] Go SDK
>
> 1. [Install and initialize the Nebius SDK for Go](https://docs.nebius.com/sdk/go/install-auth.md).
> 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` or `auditlogs.audit-event-exporter` role within your tenant. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.
> 3. Make sure that you have the `storage.uploader` role for the destination Object Storage bucket.
> 4. Identify the regions to export audit events from.

> [tab] Python SDK
>
> 1. [Install and initialize the Nebius SDK for Python](https://docs.nebius.com/sdk/python/install-auth.md).
> 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` or `auditlogs.audit-event-exporter` role within your tenant. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.
> 3. Make sure that you have the `storage.uploader` role for the destination Object Storage bucket.
> 4. Identify the regions to export audit events from.

> [tab] JavaScript SDK
>
> 1. [Install and initialize the Nebius SDK for JavaScript](https://docs.nebius.com/sdk/javascript/install-auth.md).
> 2. Make sure you are in a [group](https://docs.nebius.com/iam/authorization/groups/index.md) that has the `admin` or `auditlogs.audit-event-exporter` role within your tenant. You can check this in the [Administration → IAM](https://console.nebius.com/iam) section of the web console.
> 3. Make sure that you have the `storage.uploader` role for the destination Object Storage bucket.
> 4. Identify the regions to export audit events from.

## How to export events

1. Copy the ID of the tenant you want to export events for:

   > [tab] CLI
   >
   > List the tenants:
   >
   > ```bash theme={null}
   > nebius iam tenant list
   > ```
   >
   > Copy the tenant ID from the output.

   > [tab] Go SDK
   >
   > List the tenants:
   >
   > ```go theme={null}
   > tenantService := sdk.Services().IAM().V2().Tenant()
   > tenants, err := tenantService.List(ctx, &iam.ListTenantsRequest{})
   > if err != nil {
   >     return fmt.Errorf("list tenants: %w", err)
   > }
   > fmt.Println(tenants)
   > ```
   >
   > Copy the tenant ID from the output.

   > [tab] Python SDK
   >
   > List the tenants:
   >
   > ```python theme={null}
   > tenant_service = TenantServiceClient(sdk)
   > tenants = await tenant_service.list(ListTenantsRequest())
   > print(tenants)
   > ```
   >
   > Copy the tenant ID from the output.

   > [tab] JavaScript SDK
   >
   > List the tenants:
   >
   > ```ts theme={null}
   > const tenantService = new TenantService(sdk);
   > const tenants = await tenantService.list(
   >   ListTenantsRequest.create({}),
   > ).result;
   > console.log(tenants);
   > ```
   >
   > Copy the tenant ID from the output.

2. Select an existing bucket or [create a new one](https://docs.nebius.com/object-storage/buckets/manage.md#how-to-create-buckets) in the region you export events from — the destination bucket must be in the same region as the events. Copy the bucket ID.

3. Start an export:

   > [tab] CLI
   >
   > ```bash theme={null}
   > nebius audit v2 audit-event-export start \
   >    --parent-id <tenant_ID> \
   >    --params-from <time_in_ISO_8601> \
   >    --params-to <time_in_ISO_8601> \
   >    --region <region_ID> \
   >    --nebius-object-storage-bucket-by-id-id <bucket_ID> \
   >    --params-event-type <control_plane|data_plane> \
   >    --nebius-object-storage-object-prefix <prefix> \
   >    --params-filter "<filter_expression>"
   > ```
   >
   > In the command above, specify:
   >
   > * `--parent-id`: Tenant ID that you copied earlier.
   > * `--params-from`: Start time for the export, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
   > * `--params-to`: End time for the export, in the ISO 8601 format.
   > * `--region`: [Region](https://docs.nebius.com/overview/regions.md) to export audit events from.
   > * `--nebius-object-storage-bucket-by-id-id`: Destination bucket ID that you copied earlier. The bucket must be in the same region as the exported events.
   > * `--params-event-type` (optional): Type of audit event to export: `control_plane` or `data_plane`. Default: `control_plane`.
   >   * **Control plane events** (default): Track management operations on resources, such as creating, updating, or deleting virtual machines, clusters, or other infrastructure resources.
   >   * **Data plane events**: Track data access operations, such as reading or writing objects in Object Storage buckets.
   > * `--nebius-object-storage-object-prefix` (optional): Object prefix. If you omit it, the `auditlogs` prefix is used by default.
   > * `--params-filter` (optional): Filter expression to narrow down exported events. For more information, see [How to filter audit events](https://docs.nebius.com/audit-logs/events/filter.md#how-to-filter-events-by-using-the-cli-or-an-sdk-cli).
   >
   > The command returns an operation that confirms the export was created.

   > [tab] Go SDK
   >
   > ```go theme={null}
   > initialStart, err := time.Parse(
   >     time.RFC3339, "<time_in_ISO_8601>",
   > )
   > if err != nil {
   >     return fmt.Errorf("parse start time: %w", err)
   > }
   > initialEnd, err := time.Parse(
   >     time.RFC3339, "<time_in_ISO_8601>",
   > )
   > if err != nil {
   >     return fmt.Errorf("parse end time: %w", err)
   > }
   > initialFilter := "<filter_expression>"
   > initialBucket := &audit.NebiusObjectStorageDestination_BucketById{
   >     BucketById: &audit.BucketById{Id: "<bucket_ID>"},
   > }
   > initialStorage := &audit.NebiusObjectStorageDestination{
   >     ObjectPrefix: "<prefix>",
   >     Bucket: initialBucket,
   > }
   > initialDestination := &audit.AuditEventExportSpec_NebiusObjectStorage{
   >     NebiusObjectStorage: initialStorage,
   > }
   > initialService := sdk.Services().Audit().V2().AuditEventExport()
   > initialOperation, err := initialService.Start(
   >     ctx,
   >     &audit.StartRequest{
   >         Metadata: &common.ResourceMetadata{
   >             ParentId: "<tenant_ID>",
   >         },
   >         Spec: &audit.AuditEventExportSpec{
   >             Params: &audit.AuditEventExportParams{
   >                 From: timestamppb.New(initialStart),
   >                 To: timestamppb.New(initialEnd),
   >                 EventType: audit.EventType_CONTROL_PLANE,
   >                 Filter: initialFilter,
   >             },
   >             ExportDestination: initialDestination,
   >         },
   >         Region: "<region_ID>",
   >     },
   > )
   > if err != nil {
   >     return fmt.Errorf("start audit export: %w", err)
   > }
   > initialOperation, err = initialOperation.Wait(ctx)
   > if err != nil {
   >     return fmt.Errorf("wait for audit export: %w", err)
   > }
   > ```
   >
   > In the code, specify:
   >
   > * `Metadata.ParentId`: Tenant ID that you copied earlier.
   > * `Spec.Params.From`: Start time for the export, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format with a timezone, for example, `2026-05-07T10:00:00Z`.
   > * `Spec.Params.To`: End time for the export, in the ISO 8601 format with a timezone.
   > * `Spec.Params.EventType`: Type of audit event to export. The code sets `audit.EventType_CONTROL_PLANE`. To export data plane events, set `audit.EventType_DATA_PLANE`.
   >   * **Control plane events**: Track management operations on resources, such as creating, updating, or deleting virtual machines, clusters, or other infrastructure resources.
   >   * **Data plane events**: Track data access operations, such as reading or writing objects in Object Storage buckets.
   > * `Spec.Params.Filter` (optional): Filter expression to narrow down exported events. For more information, see [How to filter audit events](https://docs.nebius.com/audit-logs/events/filter.md#how-to-filter-events-by-using-the-cli-or-an-sdk-go-sdk).
   > * `ObjectPrefix` (optional): Object prefix on the Nebius Object Storage destination. If you remove it, the `auditlogs` prefix is used by default.
   > * `BucketById.Id`: Destination bucket ID that you copied earlier. The bucket must be in the same region as the exported events.
   > * `Region`: [Region](https://docs.nebius.com/overview/regions.md) to export audit events from.
   >
   > The code waits until the start operation finishes.

   > [tab] Python SDK
   >
   > ```python theme={null}
   > export_service = AuditEventExportServiceClient(sdk)
   > export_filter = (
   >     "<filter_expression>"
   > )
   > export_operation = await export_service.start(
   >     StartRequest(
   >         metadata=ResourceMetadata(parent_id="<tenant_ID>"),
   >         spec=AuditEventExportSpec(
   >             params=AuditEventExportParams(
   >                 from_=datetime.fromisoformat("<time_in_ISO_8601>"),
   >                 to=datetime.fromisoformat("<time_in_ISO_8601>"),
   >                 event_type=EventType.CONTROL_PLANE,
   >                 filter=export_filter,
   >             ),
   >             nebius_object_storage=NebiusObjectStorageDestination(
   >                 object_prefix="<prefix>",
   >                 bucket_by_id=BucketById(id="<bucket_ID>"),
   >             ),
   >         ),
   >         region="<region_ID>",
   >     ),
   > )
   > await export_operation.wait()
   > ```
   >
   > In the code, specify:
   >
   > * `metadata.parent_id`: Tenant ID that you copied earlier.
   > * `spec.params.from_`: Start time for the export, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format with a timezone, for example, `2026-05-07T00:00:00Z`. On Python 3.10, use `+00:00` instead of `Z`.
   > * `spec.params.to`: End time for the export, in the ISO 8601 format with a timezone, for example, `2026-05-08T00:00:00Z`. On Python 3.10, use `+00:00` instead of `Z`.
   > * `spec.params.event_type`: Type of audit event to export. The code sets `EventType.CONTROL_PLANE`. To export data plane events, set `EventType.DATA_PLANE`.
   >   * **Control plane events**: Track management operations on resources, such as creating, updating, or deleting virtual machines, clusters, or other infrastructure resources.
   >   * **Data plane events**: Track data access operations, such as reading or writing objects in Object Storage buckets.
   > * `spec.params.filter` (optional): Filter expression to narrow down exported events. For more information, see [How to filter audit events](https://docs.nebius.com/audit-logs/events/filter.md#how-to-filter-events-by-using-the-cli-or-an-sdk-python-sdk).
   > * `spec.nebius_object_storage.object_prefix` (optional): Object prefix. If you remove it, the `auditlogs` prefix is used by default.
   > * `spec.nebius_object_storage.bucket_by_id.id`: Destination bucket ID that you copied earlier. The bucket must be in the same region as the exported events.
   > * `region`: [Region](https://docs.nebius.com/overview/regions.md) to export audit events from.
   >
   > The code waits until the start operation finishes.

   > [tab] JavaScript SDK
   >
   > ```ts theme={null}
   > const initialService = new AuditEventExportService(sdk);
   > const initialFilter =
   >   "<filter_expression>";
   > const initialOperation = await initialService.start(
   >   StartRequest.create({
   >     metadata: { parentId: "<tenant_ID>" },
   >     spec: {
   >       params: {
   >         from: dayjs("<time_in_ISO_8601>"),
   >         to: dayjs("<time_in_ISO_8601>"),
   >         eventType: EventType.CONTROL_PLANE,
   >         filter: initialFilter,
   >       },
   >       exportDestination: {
   >         $case: "nebiusObjectStorage",
   >         nebiusObjectStorage: {
   >           objectPrefix: "<prefix>",
   >           bucket: {
   >             $case: "bucketById",
   >             bucketById: { id: "<bucket_ID>" },
   >           },
   >         },
   >       },
   >     },
   >     region: "<region_ID>",
   >   }),
   > ).result;
   > await initialOperation.wait();
   > ```
   >
   > In the code, specify:
   >
   > * `metadata.parentId`: Tenant ID that you copied earlier.
   > * `spec.params.from`: Start time for the export, in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format.
   > * `spec.params.to`: End time for the export, in the ISO 8601 format.
   > * `spec.params.eventType`: Type of audit event to export. The code sets `EventType.CONTROL_PLANE`. To export data plane events, set `EventType.DATA_PLANE`.
   >   * **Control plane events**: Track management operations on resources, such as creating, updating, or deleting virtual machines, clusters, or other infrastructure resources.
   >   * **Data plane events**: Track data access operations, such as reading or writing objects in Object Storage buckets.
   > * `spec.params.filter` (optional): Filter expression to narrow down exported events. For more information, see [How to filter audit events](https://docs.nebius.com/audit-logs/events/filter.md#how-to-filter-events-by-using-the-cli-or-an-sdk-javascript-sdk).
   > * `spec.exportDestination.nebiusObjectStorage.objectPrefix` (optional): Object prefix. If you remove it, the `auditlogs` prefix is used by default.
   > * `spec.exportDestination.nebiusObjectStorage.bucket.bucketById.id`: Destination bucket ID that you copied earlier. The bucket must be in the same region as the exported events.
   > * `region`: [Region](https://docs.nebius.com/overview/regions.md) to export audit events from.
   >
   > The code waits until the start operation finishes.

   The export continues running in the background.

## How to check the status of an export

To check the current state and parameters of an export, get it by ID. Get the export ID by [listing exports](#how-to-list-exports).

> [tab] CLI
>
> ```bash theme={null}
> nebius audit v2 audit-event-export get --id <export_ID>
> ```
>
> Set `--id` to the export ID.

> [tab] Go SDK
>
> ```go theme={null}
> getService := sdk.Services().Audit().V2().AuditEventExport()
> auditExport, err := getService.Get(
>     ctx,
>     &audit.GetRequest{Id: "<export_ID>"},
> )
> if err != nil {
>     return fmt.Errorf("get audit export: %w", err)
> }
> fmt.Println(auditExport)
> ```
>
> In the code, set `Id` to the export ID.

> [tab] Python SDK
>
> ```python theme={null}
> export_service = AuditEventExportServiceClient(sdk)
> audit_export = await export_service.get(
>     GetRequest(id="<export_ID>"),
> )
> print(audit_export)
> ```
>
> In the code, set `id` to the export ID.

> [tab] JavaScript SDK
>
> ```ts theme={null}
> const getService = new AuditEventExportService(sdk);
> const auditExport = await getService.get(
>   GetRequest.create({ id: "<export_ID>" }),
> ).result;
> console.log(auditExport);
> ```
>
> In the code, set `id` to the export ID.

Export lifecycle states include `RUNNING`, `DONE`, `FAILED` and `CANCELED`.

## How to list exports

To find a specific export, list all exports created for a tenant:

> [tab] CLI
>
> ```bash theme={null}
> nebius audit v2 audit-event-export list --parent-id <tenant_ID> --region <region_ID>
> ```
>
> In the command, specify:
>
> * `--parent-id`: Tenant ID that you copied earlier.
> * `--region`: [Region](https://docs.nebius.com/overview/regions.md) where you started the export.

> [tab] Go SDK
>
> ```go theme={null}
> listedService := sdk.Services().Audit().V2().
>     AuditEventExport()
> listedExports, err := listedService.List(
>     ctx,
>     &audit.ListRequest{
>         ParentId: "<tenant_ID>",
>         Region: "<region_ID>",
>     },
> )
> if err != nil {
>     return fmt.Errorf("list audit exports: %w", err)
> }
> fmt.Println(listedExports)
> ```
>
> In the code, specify:
>
> * `ParentId`: Tenant ID that you copied earlier.
> * `Region`: [Region](https://docs.nebius.com/overview/regions.md) where you started the export.

> [tab] Python SDK
>
> ```python theme={null}
> export_service = AuditEventExportServiceClient(sdk)
> exports = await export_service.list(
>     ListRequest(
>         parent_id="<tenant_ID>",
>         region="<region_ID>",
>     ),
> )
> print(exports)
> ```
>
> In the code, specify:
>
> * `parent_id`: Tenant ID that you copied earlier.
> * `region`: [Region](https://docs.nebius.com/overview/regions.md) where you started the export.

> [tab] JavaScript SDK
>
> ```ts theme={null}
> const listedService = new AuditEventExportService(sdk);
> const listedExports = await listedService.list(
>   ListRequest.create({
>     parentId: "<tenant_ID>",
>     region: "<region_ID>",
>   }),
> ).result;
> console.log(listedExports);
> ```
>
> In the code, specify:
>
> * `parentId`: Tenant ID that you copied earlier.
> * `region`: [Region](https://docs.nebius.com/overview/regions.md) where you started the export.

## How to download exported events

After an export reaches the `DONE` state, the exported audit events are available as objects in the destination bucket. To download these objects to your local machine for data portability or local storage:

1. [View the objects](https://docs.nebius.com/object-storage/objects/manage.md#how-to-view-objects) in the bucket to find the exported files. The objects are stored under the prefix that you specified when you launched the export, or under the default `auditlogs` prefix.

2. [Download the objects](https://docs.nebius.com/object-storage/objects/upload-download.md#how-to-download) from the bucket to your local machine. You can download a single object or all objects with a specific prefix.

   For example, to download all exported audit events with the default `auditlogs` prefix:

   ```bash theme={null}
   aws s3 cp --recursive \
       s3://<bucket_name>/auditlogs/ \
       <local_destination_path>
   ```

   Replace `<bucket_name>` with the name of the destination bucket and `<local_destination_path>` with the directory on your machine.

## How to cancel an export

To stop an active export, cancel it by ID. Use the export ID from [the list of exports](#how-to-list-exports).

> [tab] CLI
>
> ```bash theme={null}
> nebius audit v2 audit-event-export cancel --id <export_ID>
> ```
>
> Set `--id` to the export ID.

> [tab] Go SDK
>
> ```go theme={null}
> cancelService := sdk.Services().Audit().V2().
>     AuditEventExport()
> cancelOperation, err := cancelService.Cancel(
>     ctx,
>     &audit.CancelRequest{Id: "<export_ID>"},
> )
> if err != nil {
>     return fmt.Errorf("cancel audit export: %w", err)
> }
> cancelOperation, err = cancelOperation.Wait(ctx)
> if err != nil {
>     return fmt.Errorf("wait for audit export cancellation: %w", err)
> }
> ```
>
> In the code, set `Id` to the export ID. The code waits until the cancellation finishes.

> [tab] Python SDK
>
> ```python theme={null}
> export_service = AuditEventExportServiceClient(sdk)
> cancel_operation = await export_service.cancel(
>     CancelRequest(id="<export_ID>"),
> )
> await cancel_operation.wait()
> ```
>
> In the code, set `id` to the export ID. The code waits until the cancellation finishes.

> [tab] JavaScript SDK
>
> ```ts theme={null}
> const cancelService = new AuditEventExportService(sdk);
> const cancelOperation = await cancelService.cancel(
>   CancelRequest.create({ id: "<export_ID>" }),
> ).result;
> await cancelOperation.wait();
> ```
>
> In the code, set `id` to the export ID. The code waits until the cancellation finishes.

The export transitions to the `CANCELED` state. Data that is already written to the bucket is preserved.
