# AUDIT.EXPORT

> Export the audit log to a file on the server as JSON Lines, CSV or CEF.

URL: https://docs.hotkv.com/commands/audit-export/

```
AUDIT.EXPORT file [FORMAT jsonl | csv | cef]
```

- Group: Audit
- Complexity: O(N) where N is the number of entries
- HotKV Cloud: Scale plan
- On-Premise: requires the audit-log license feature

`AUDIT.EXPORT` writes every entry of the current audit log file to `file`,
a path on the server, in the format you choose. An existing file is
overwritten. Use it to feed the log into a SIEM or a spreadsheet.

## Options

| Format | Output |
| --- | --- |
| `jsonl` (default) | One JSON object per line. |
| `csv` | A header line, then one line per entry. |
| `cef` | One ArcSight Common Event Format line per entry. |

The format name is not case sensitive. The command cannot be called from a
script.

## Return value

Simple string `OK` in RESP2 and RESP3, or one of these errors:

| Case | Error |
| --- | --- |
| Unknown format | `ERR unknown format, use jsonl\|csv\|cef` |
| The file could not be written | `ERR export failed` |
| No license that includes `audit-log` | `NOLICENSE audit-log requires a HotKV license. Contact sales@hotkv.com` |

## Examples

```
127.0.0.1:6379> AUDIT.EXPORT /var/log/hotkv/audit-export.csv FORMAT csv
OK
127.0.0.1:6379> AUDIT.EXPORT /var/log/hotkv/audit-export.jsonl
OK
127.0.0.1:6379> AUDIT.EXPORT /tmp/audit.xml FORMAT xml
(error) ERR unknown format, use jsonl|csv|cef
```

## Compatibility

HotKV-only command.

## See also

[AUDIT.INFO](https://docs.hotkv.com/commands/audit-info/index.md), [AUDIT.ROTATE](https://docs.hotkv.com/commands/audit-rotate/index.md)