2017-03-15 06:40:33 +00:00
|
|
|
|
---
|
2020-01-18 00:18:09 +00:00
|
|
|
|
layout: api
|
|
|
|
|
page_title: /sys/audit - HTTP API
|
|
|
|
|
description: The `/sys/audit` endpoint is used to enable and disable audit devices.
|
2017-03-15 06:40:33 +00:00
|
|
|
|
---
|
|
|
|
|
|
|
|
|
|
# `/sys/audit`
|
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
The `/sys/audit` endpoint is used to list, enable, and disable audit devices.
|
|
|
|
|
Audit devices must be enabled before use, and more than one device may be
|
2017-03-15 06:40:33 +00:00
|
|
|
|
enabled at a time.
|
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
## List Enabled Audit Devices
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
This endpoint lists only the enabled audit devices (it does not list all
|
|
|
|
|
available audit devices).
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
- **`sudo` required** – This endpoint requires `sudo` capability in addition to
|
|
|
|
|
any path-specific capabilities.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :----------- |
|
|
|
|
|
| `GET` | `/sys/audit` |
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-03-15 06:40:33 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/sys/audit
|
2017-03-15 06:40:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Response
|
|
|
|
|
|
|
|
|
|
```javascript
|
|
|
|
|
{
|
|
|
|
|
"file": {
|
|
|
|
|
"type": "file",
|
|
|
|
|
"description": "Store logs in a file",
|
|
|
|
|
"options": {
|
2018-09-20 22:55:20 +00:00
|
|
|
|
"file_path": "/var/log/vault.log"
|
2017-03-15 06:40:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
## Enable Audit Device
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
This endpoint enables a new audit device at the supplied path. The path can be a
|
2017-03-15 06:40:33 +00:00
|
|
|
|
single word name or a more complex, nested path.
|
|
|
|
|
|
|
|
|
|
- **`sudo` required** – This endpoint requires `sudo` capability in addition to
|
|
|
|
|
any path-specific capabilities.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :----- | :----------------- |
|
|
|
|
|
| `PUT` | `/sys/audit/:path` |
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
- `path` `(string: <required>)` – Specifies the path in which to enable the audit
|
|
|
|
|
device. This is part of the request URL.
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
- `description` `(string: "")` – Specifies a human-friendly description of the
|
2017-09-21 21:14:40 +00:00
|
|
|
|
audit device.
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
- `options` `(map<string|string>: nil)` – Specifies configuration options to
|
2017-09-21 21:14:40 +00:00
|
|
|
|
pass to the audit device itself. This is dependent on the audit device type.
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
- `type` `(string: <required>)` – Specifies the type of the audit device.
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
2017-04-28 18:33:27 +00:00
|
|
|
|
Additionally, the following options are allowed in Vault open-source, but
|
|
|
|
|
relevant functionality is only supported in Vault Enterprise:
|
|
|
|
|
|
2021-09-01 20:53:01 +00:00
|
|
|
|
- `local` `(bool: false)` – Specifies if the audit device is local within the cluster only. Local
|
2017-09-21 21:14:40 +00:00
|
|
|
|
audit devices are not replicated nor (if a secondary) removed by replication.
|
2017-04-28 18:33:27 +00:00
|
|
|
|
|
2017-03-15 06:40:33 +00:00
|
|
|
|
### Sample Payload
|
|
|
|
|
|
|
|
|
|
```json
|
|
|
|
|
{
|
|
|
|
|
"type": "file",
|
|
|
|
|
"options": {
|
2018-09-20 22:55:20 +00:00
|
|
|
|
"file_path": "/var/log/vault/log"
|
2017-03-15 06:40:33 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
```
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-03-15 06:40:33 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request PUT \
|
|
|
|
|
--data @payload.json \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/sys/audit/example-audit
|
2017-03-15 06:40:33 +00:00
|
|
|
|
```
|
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
## Disable Audit Device
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
This endpoint disables the audit device at the given path.
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
- **`sudo` required** – This endpoint requires `sudo` capability in addition to
|
|
|
|
|
any path-specific capabilities.
|
|
|
|
|
|
2020-01-18 00:18:09 +00:00
|
|
|
|
| Method | Path |
|
|
|
|
|
| :------- | :----------------- |
|
|
|
|
|
| `DELETE` | `/sys/audit/:path` |
|
2017-03-15 06:40:33 +00:00
|
|
|
|
|
|
|
|
|
### Parameters
|
|
|
|
|
|
2017-09-21 21:14:40 +00:00
|
|
|
|
- `path` `(string: <required>)` – Specifies the path of the audit device to
|
2017-03-15 06:40:33 +00:00
|
|
|
|
delete. This is part of the request URL.
|
|
|
|
|
|
|
|
|
|
### Sample Request
|
|
|
|
|
|
2020-05-21 17:18:17 +00:00
|
|
|
|
```shell-session
|
2017-03-15 06:40:33 +00:00
|
|
|
|
$ curl \
|
|
|
|
|
--header "X-Vault-Token: ..." \
|
|
|
|
|
--request DELETE \
|
2018-03-23 15:41:51 +00:00
|
|
|
|
http://127.0.0.1:8200/v1/sys/audit/example-audit
|
2017-03-15 06:40:33 +00:00
|
|
|
|
```
|