Skip to content

Commit 8453baf

Browse files
Monitoring audit logging (#352)
This PR implements post-migration activities on the `audit logging` section of the new IA. It covers some of the tasks from elastic/docs-projects#350. --------- Co-authored-by: shainaraskas <[email protected]>
1 parent 026c775 commit 8453baf

28 files changed

+302
-1851
lines changed

deploy-manage/monitor/logging-configuration/auditing-search-queries.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,39 @@ applies:
66
ece: all
77
eck: all
88
stack: all
9+
serverless: unavailable
910
---
1011

11-
# Auditing search queries [auditing-search-queries]
12+
# Audit Elasticsearch search queries [auditing-search-queries]
1213

13-
There is no [audit event type](elasticsearch-audit-events.md) specifically dedicated to search queries. Search queries are analyzed and then processed; the processing triggers authorization actions that are audited. However, the original raw query, as submitted by the client, is not accessible downstream when authorization auditing occurs.
14+
There is no [audit event type]() (asciidocalypse://elasticsearch/docs/reference/elasticsearch/elasticsearch-audit-events) specifically dedicated to search queries. Search queries are analyzed and then processed; the processing triggers authorization actions that are audited. However, the original raw query, as submitted by the client, is not accessible downstream when authorization auditing occurs.
1415

1516
Search queries are contained inside HTTP request bodies, however, and some audit events that are generated by the REST layer, on the coordinating node, can be toggled to output the request body to the audit log. Therefore, one must audit request bodies in order to audit search queries.
1617

17-
To make certain audit events include the request body, edit the following setting in the `elasticsearch.yml` file:
18+
To make certain audit events include the request body, configure the following setting in {{es}}:
1819

1920
```yaml
2021
xpack.security.audit.logfile.events.emit_request_body: true
2122
```
2223
24+
You can apply this setting through [cluster update settings API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html), as described in [](./configuring-audit-logs.md). Alternatively, you can modify `elasticsearch.yml` in all nodes and restart for the changes to take effect.
25+
2326
::::{important}
2427
No filtering is performed when auditing, so sensitive data might be audited in plain text when audit events include the request body. Also, the request body can contain malicious content that can break a parser consuming the audit logs.
2528
::::
2629

27-
2830
The request body is printed as an escaped JSON string value (RFC 4627) to the `request.body` event attribute.
2931

30-
Not all events contain the `request.body` attribute, even when the above setting is toggled. The ones that do are: `authentication_success`, `authentication_failed`, `realm_authentication_failed`, `tampered_request`, `run_as_denied`, and `anonymous_access_denied`. The `request.body` attribute is printed on the coordinating node only (the node that handles the REST request). Most of these event types are [not included by default](https://www.elastic.co/guide/en/elasticsearch/reference/current/auditing-settings.html#xpack-sa-lf-events-include).
32+
Not all events contain the `request.body` attribute, even when the above setting is toggled. The ones that do are:
33+
34+
* `authentication_success`
35+
* `authentication_failed`
36+
* `realm_authentication_failed`
37+
* `tampered_request`
38+
* `run_as_denied`
39+
* `anonymous_access_denied`
40+
41+
The `request.body` attribute is printed on the coordinating node only (the node that handles the REST request). Most of these event types are [not included by default](https://www.elastic.co/guide/en/elasticsearch/reference/current/auditing-settings.html#xpack-sa-lf-events-include).
3142

3243
A good practical piece of advice is to add `authentication_success` to the event types that are audited (add it to the list in the `xpack.security.audit.logfile.events.include`), as this event type is not audited by default.
3344

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
---
2+
applies:
3+
hosted: all
4+
ece: all
5+
eck: all
6+
stack: all
7+
serverless: unavailable
8+
---
9+
10+
# Configure audit logging [audit-logging-configuration]
11+
12+
When auditing security events, a single client request might generate multiple audit events across multiple cluster nodes, potentially leading to a high volume of log data and I/O operations. To maintain clarity and ensure logs remain actionable, {{es}} and {{kib}} provide configuration mechanisms to control what events are logged and which can be ignored.
13+
14+
### Elasticsearch auditing configuration
15+
16+
{{es}} configuration options include:
17+
18+
* [{{es}} audited events settings](https://www.elastic.co/guide/en/elasticsearch/reference/current/auditing-settings.html#event-audit-settings): Use include and exclude filters to control the types of events that get logged.
19+
* [{{es}} node information settings](https://www.elastic.co/guide/en/elasticsearch/reference/current/auditing-settings.html#node-audit-settings): Control whether to add or hide node information such as hostname or IP address in the audited events.
20+
* [{{es}} ignore policies settings](https://www.elastic.co/guide/en/elasticsearch/reference/current/auditing-settings.html#audit-event-ignore-policies): Use ignore policies for fine-grained control over which audit events are printed to the log file.
21+
22+
::::{tip}
23+
In {{es}}, all auditing settings except `xpack.security.audit.enabled` are dynamic. This means you can configure them using the [cluster update settings API](https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-update-settings.html), allowing changes to take effect immediately without requiring a restart. This approach is faster and more convenient than modifying `elasticsearch.yml`.
24+
::::
25+
26+
For a complete description of event details and format, refer to the following resources:
27+
* [{{es}} audit events details and schema]() asciidocalypse://elasticsearch/docs/reference/elasticsearch/elasticsearch-audit-events
28+
* [{{es}} log entry output format](/deploy-manage/monitor/logging-configuration/logfile-audit-output.md#audit-log-entry-format)
29+
30+
### Kibana auditing configuration
31+
32+
To control the logs that are outputted by Kibana, you can use [{{kib}} ignore filters](https://www.elastic.co/guide/en/kibana/current/security-settings-kb.html#audit-logging-ignore-filters). These are a list of filters that determine which events should be excluded from the audit log.
33+
34+
In self-managed systems, you can optionally configure audit logs location, and file/rolling file using [{{kib}} audit logging settings](https://www.elastic.co/guide/en/kibana/current/security-settings-kb.html#audit-logging-settings).
35+
36+
37+
::::{tip}
38+
To configure {{kib}} settings, follow the same [procedure](./enabling-audit-logs.md#enable-audit-logging-procedure) as when enabling {{kib}} audit logs, but apply the relevant settings instead.
39+
::::
40+
41+
For a complete description of auditing event details, such as `category`, `type`, or `action`, refer to [{{kib}} audit events](https://www.elastic.co/guide/en/kibana/current/xpack-security-audit-logging.html#xpack-security-ecs-audit-logging).
42+
43+
### General recommendations
44+
45+
* Consider starting with {{es}} [`xpack.security.audit.logfile.events.include`](https://www.elastic.co/guide/en/elasticsearch/reference/current/auditing-settings.html#xpack-sa-lf-events-include) and [{{kib}} ignore filters](https://www.elastic.co/guide/en/kibana/current/security-settings-kb.html#audit-logging-ignore-filters) settings to specify the type of events you want to include or exclude in the auditing output.
46+
47+
* If you need a more granular control, refer to [{{es}} audit events ignore policies](./logfile-audit-events-ignore-policies.md) for a better understanding how ignore policies work and when they are beneficial.
48+
49+
* Refer to [auditing search queries](./auditing-search-queries.md) for details on logging request bodies in the {{es}} audit logs.
50+
51+
::::{important}
52+
Sensitive data may be audited in plain text when including the request body in audit events, even though all the security APIs, such as those that change the user’s password, have the credentials filtered out when audited.
53+
::::

0 commit comments

Comments
 (0)