---
title: "Class ExportCommand"
slug: "cli--sitecore.ch.cli.plugin.audit.commands.exportcommand"
abstract: ""
---
# Class ExportCommand

Exports the audit log from the selected Content Hub instance.

## Inheritance

object

System.CommandLine.Symbol

System.CommandLine.IdentifierSymbol

[Command](https://learn.microsoft.com/dotnet/api/system.commandline.command)

Sitecore.CH.Cli.Core.Abstractions.Commands.BaseCommand

Sitecore.CH.Cli.Core.Abstractions.Commands.BaseCommand<THandler>Sitecore.CH.Cli.Plugin.Audit.CommandHandlers.ExportCommandHandler

ExportCommand

## Namespace: SitecoreSitecore.CHSitecore.CH.CliSitecore.CH.Cli.PluginSitecore.CH.Cli.Plugin.AuditCommands

## Assembly: Sitecore.CH.Cli.Plugin.Audit.dll

## Syntax

```csharp
public class ExportCommand : BaseCommand<ExportCommandHandler>
```

## Remarks

**Required parameters**

- `--source -s` Specifies the source audit log. Possible values: Action, Business, Raw, Reporting, Scripting, Trigger, User

**Optional parameters**

- `--format -f` Defines the output format. Default value: JSON
- `--start-time -t` Defines the start date and time for the log export. Default value: <now> - 1 hour
- `--span -sp` Specifies the time span for the export. Default value: 1 hour
- `--wait -w` Determines whether to wait for the export to complete or not.
- `--out -o` Specifies the output file name.
- `--order-id` Specifies whether the raw order id returned or not.
- `--endpoint -e` Specifies an alternative endpoint name for the execution of this command.

**Global parameters**

- `-? --help -h` Show this help message and exit.
- `-v --verbosity` Enables verbose logging.

## Examples

Export a log using the default parameters:

```csharp
ch-cli audit export --source Raw --wait
```

Queue an export job and retrieve the raw job id:

```csharp
ch-cli audit export --source Raw --order-id
```

Export a log using a customized date range:

```csharp
ch-cli audit export --source User --format Csv --start-time "2020-11-01 `00:00`:00" --span `06:00`:00 --wait
```

Export a log and save the resulting package:

```csharp
ch-cli audit export --source User --out "<local path>"
```
