Skip to content
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
6a1979e
audit logging initial changes
eedugon Feb 5, 2025
d870029
elasticsearch audit events prepared to be moved to reference
eedugon Feb 5, 2025
07e5dec
work in progress, applying shaina's suggestions
eedugon Feb 5, 2025
460db8e
audit logging updated
eedugon Feb 6, 2025
838bf49
audit logging more updates
eedugon Feb 6, 2025
c559ba0
extra changes for a draft PR
eedugon Feb 6, 2025
94f9220
refining changes and removing migration comments
eedugon Feb 6, 2025
9cf349f
small update
eedugon Feb 6, 2025
6e9e46c
toc and titles updated
eedugon Feb 6, 2025
dc389b4
enable audit log simplified a bit
eedugon Feb 7, 2025
3bc8233
added serverless unavailble tags
eedugon Feb 7, 2025
c4347ef
link fixed
eedugon Feb 7, 2025
8f298ee
Merge branch 'main' into monitoring_audit_logging
eedugon Feb 7, 2025
2c2517d
renaming again with tool to fix links
eedugon Feb 7, 2025
b4d38b7
links fixed due to kibana audit logs file deleted
eedugon Feb 7, 2025
d4491dd
subscription feature note updated
eedugon Feb 7, 2025
fee0d0a
fixing conflicts
eedugon Feb 12, 2025
7e86fe4
fixed link in get-started/introduction.md file
eedugon Feb 12, 2025
1b4dd3f
Update manage-data/ingest/ingesting-data-from-applications/ingest-dat…
eedugon Feb 12, 2025
542f5a5
Update manage-data/ingest/ingesting-data-from-applications/ingest-dat…
eedugon Feb 12, 2025
e852bd4
changes applied per psanz suggestions
eedugon Feb 13, 2025
b206e7f
resolved small conflicts
eedugon Feb 13, 2025
433fdbc
fixing links
eedugon Feb 13, 2025
a107e95
correlating events updated
eedugon Feb 13, 2025
55db7cb
audit request body updated
eedugon Feb 13, 2025
f801787
minor changes, ready for review
eedugon Feb 13, 2025
6e4bb9a
Merge branch 'main' into monitoring_audit_logging
eedugon Feb 13, 2025
df94d2c
Apply suggestions from code review
eedugon Feb 17, 2025
79e6760
Update deploy-manage/monitor/logging-configuration/correlating-kibana…
eedugon Feb 17, 2025
24d1154
changes post Shaina's review
eedugon Feb 17, 2025
664a9fe
elasticsearch audit details removed and asciidocalypse temp links added
eedugon Feb 18, 2025
e19962a
fixing conflicts
eedugon Feb 18, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ applies:
stack: all
---

# Auditing search queries [auditing-search-queries]
# Audit Elasticsearch search queries [auditing-search-queries]

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.

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.

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

```yaml
xpack.security.audit.logfile.events.emit_request_body: true
```

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.

::::{important}
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.
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.
::::


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

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).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
---
applies:
hosted: all
ece: all
eck: all
stack: all
serverless: unavailable
---

# Configure audit logging [audit-logging-configuration]

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.

### Elasticsearch auditing configuration

{{es}} configuration options include:

* [{{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.
* [{{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.
* [{{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.

::::{tip}
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`.
::::

Note that {{ech}} deployments provide its own subset of supported settings for auditing configuration:
* [Elasticsearch audit settings for Elastic Cloud Hosted deployments](https://www.elastic.co/guide/en/cloud/current/ec-add-user-settings.html#ec_audit_settings)

For a complete description of event details and format, refer to:
* [{{es}} audit events details and schema](/deploy-manage/monitor/logging-configuration/elasticsearch-audit-events.md).
* [{{es}} logentry output format](/deploy-manage/monitor/logging-configuration/logfile-audit-output.md#audit-log-entry-format)

### Kibana auditing configuration

{{kib}} configuration options include:

* [{{kib}} ignore filters](https://www.elastic.co/guide/en/kibana/current/security-settings-kb.html#audit-logging-ignore-filters): List of filters that determine which events should be excluded from the audit log.

::::{tip}
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.
::::

Note that {{ech}} deployments provide its own subset of supported settings for auditing configuration:
* [Kibana audit settings on Elastic Cloud](https://www.elastic.co/guide/en/cloud/current/ec-manage-kibana-settings.html#ec_logging_and_audit_settings)

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)

### General recommendations

* Consider starting with [`xpack.security.audit.logfile.events.include`](https://www.elastic.co/guide/en/elasticsearch/reference/current/auditing-settings.html#xpack-sa-lf-events-include) or the corresponding `exclude` setting to specify the type of events you want to include or exclude in the {{es}} auditing output.

* 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.

* Refer to [auditing search queries](./auditing-search-queries.md) for details on logging request bodies in the {{es}} audit logs.

::::{important}
Be advised that **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.
::::

* Use {{kib}} [ignore filters](https://www.elastic.co/guide/en/kibana/current/security-settings-kb.html#audit-logging-ignore-filters) if you want to filter out certain events from the {{kib}} audit log.
Loading
Loading