This section provides detailed reference information for Elasticsearch audit events.
Refer to Security event audit logging in the Deploy and manage section for overview, getting started and conceptual information about audit logging.
When you are auditing security events, a single client request might generate multiple audit events, across multiple cluster nodes. The common request.id attribute can be used to correlate the associated events.
This document provides a reference for all types of audit events and their associated attributes in Elasticsearch. Use audit event settings options to control what gets logged.
For more information and options about tuning audit logs, refer to Configuring audit logs.
Note
Certain audit events require the security_config_change event type to log the related event action. The event descriptions in this document indicate whether this requirement is applicable.
Logged when an authenticated user attempts to execute an action they have the necessary privilege to perform. These events will be logged only for non-system users.
If you want to include access_granted events for all users (including internal users such as _xpack), add system_access_granted to the list of event types in addition to access_granted. The system_access_granted privilege is not included by default to avoid cluttering the logs.
Logs access_granted events only for internal users, such as _xpack. If you include this setting in addition to access_granted, then access_granted events are logged for all users.
Note
This event type is disabled by default to avoid cluttering the logs.
tampered_request
Logged when the security features detect that the request has been tampered with. Typically relates to search/scroll requests when the scroll ID is believed to have been tampered with.
The audit events are formatted as JSON documents, and each event is printed on a separate line in the audit log. The entries themselves do not contain an end-of-line delimiter. For more details, see Log entry format.
The following list shows attributes that are common to all audit event types:
@timestamp
The time, in ISO9601 format, when the event occurred.
node.name
The name of the node. This can be changed in the elasticsearch.yml config file.
node.id
The node id. This is automatically generated and is persistent across full cluster restarts.
host.ip
The bound IP address of the node, with which the node can be communicated with.
host.name
The unresolved node’s hostname.
event.type
The internal processing layer that generated the event: rest, transport, ip_filter or security_config_change. This is different from origin.type because a request originating from the REST API is translated to a number of transport messages, generating audit events with origin.type: rest and event.type: transport.
event.action
The type of event that occurred: anonymous_access_denied, authentication_failed, authentication_success, realm_authentication_failed, access_denied, access_granted, connection_denied, connection_granted, tampered_request, run_as_denied, or run_as_granted.
In addition, if event.type equals security_config_change, the event.action attribute takes one of the following values: put_user, change_password, put_role, put_role_mapping, change_enable_user, change_disable_user, put_privileges, create_apikey, delete_user, delete_role, delete_role_mapping, invalidate_apikeys, delete_privileges, change_apikey, or change_apikeys.
request.id
A synthetic identifier that can be used to correlate the events associated with a particular REST request.
In addition, all the events of types rest, transport and ip_filter (but not security_config_change) have the following extra attributes, which show more details about the requesting client:
origin.address
The source IP address of the request associated with this event. This could be the address of the remote client, the address of another cluster node, or the local node’s bound address, if the request originated locally. Unless the remote client connects directly to the cluster, the client address will actually be the address of the first OSI layer 3 proxy in front of the cluster.
origin.type
The origin type of the request associated with this event: rest (request originated from a REST API request), transport (request was received on the transport channel), or local_node (the local node issued the request).
The identifier extracted from the traceparent HTTP header (if present) of the request associated with this event. It allows to surface audit logs into the Trace Logs feature of Elastic APM.
x_forwarded_for
The verbatim value of the X-Forwarded-For HTTP request header (if present) of the request associated with the audit event. This header is commonly added by proxies when they forward requests and the value is the address of the proxied client. When a request crosses multiple proxies the header is a comma delimited list with the last value being the address of the second to last proxy server (the address of the last proxy server is designated by the origin.address field).
The events with event.type equal to rest have one of the following event.action attribute values: authentication_success, anonymous_access_denied, authentication_failed, realm_authentication_failed, tampered_request or run_as_denied. These events also have the following extra attributes (in addition to the common ones):
url.path
The path part of the URL (between the port and the query string) of the REST request associated with this event. This is URL encoded.
url.query
The query part of the URL (after "?", if present) of the REST request associated with this event. This is URL encoded.
request.method
The HTTP method of the REST request associated with this event. It is one of GET, POST, PUT, DELETE, OPTIONS, HEAD, PATCH, TRACE and CONNECT.
request.body
The full content of the REST request associated with this event, if enabled. This contains the HTTP request body. The body is escaped as a string value according to the JSON RFC 4627.
The events with event.type equal to transport have one of the following event.action attribute values: authentication_success, anonymous_access_denied, authentication_failed, realm_authentication_failed, access_granted, access_denied, run_as_granted, run_as_denied, or tampered_request. These events also have the following extra attributes (in addition to the common ones):
action
The name of the transport action that was executed. This is like the URL for a REST request.
indices
The indices names array that the request associated with this event pertains to (when applicable).
request.name
The name of the request handler that was executed.
The events with event.type equal to ip_filter have one of the following event.action attribute values: connection_granted or connection_denied. These events also have the following extra attributes (in addition to the common ones):
The events with the event.type attribute equal to security_config_change have one of the following event.action attribute values: put_user, change_password, put_role, put_role_mapping, change_enable_user, change_disable_user, put_privileges, create_apikey, delete_user, delete_role, delete_role_mapping, invalidate_apikeys, delete_privileges, change_apikey, or change_apikeys.
These events also have one of the following extra attributes (in addition to the common ones), which is specific to the event.type attribute. The attribute’s value is a nested JSON object:
put
The object representation of the security config that is being created, or the overwrite of an existing config. It contains the config for a user, role, role_mapping, or for application privileges.
delete
The object representation of the security config that is being deleted. It can be the config for a user, role, role_mapping or for application privileges.
change
The object representation of the security config that is being changed. It can be the password, enable or disable, config object for native or built-in users. If an API key is updated, the config object will be an apikey.
create
The object representation of the new security config that is being created. This is currently only used for API keys auditing. If the API key is created using the create API key API it only contains an apikey config object. If the API key is created using the grant API key API it also contains a grant config object.
invalidate
The object representation of the security configuration that is being invalidated. The only config that currently supports invalidation is apikeys, through the invalidate API key API.
The schemas of the security config objects mentioned above are as follows. They are very similar to the request bodies of the corresponding security APIs.
The roles and role_templates fields are omitted if empty. The rules object has a recursively nested schema, identical to what is passed in the API request for mapping roles.
The object for a bulk API key update will differ in that it will not include name, owned_by_authenticated_user, or user. Instead, it may include metadata and role_descriptors, which have the same schemas as the fields in the apikey config object above.
There are a few events that have some more attributes in addition to those that have been previously described:
authentication_success:
realm
The name of the realm that successfully authenticated the user. If authenticated using an API key, this is the special value of _es_api_key. This is a shorthand attribute for the same information that is described by the user.realm, user.run_by.realm and authentication.type attributes.
user.name
The name of the effective user. This is usually the same as the authenticated user, but if using the run as authorization functionality this instead denotes the name of the impersonated user. If authenticated using an API key, this is the name of the API key owner. If authenticated using a service account token, this is the service account principal, i.e. namespace/service_name.
user.realm
Name of the realm to which the effective user belongs. If authenticated using an API key, this is the name of the realm to which the API key owner belongs.
user.run_by.name
This attribute is present only if the request is using the run as authorization functionality and denotes the name of the authenticated user, which is also known as the impersonator.
user.run_by.realm
Name of the realm to which the authenticated (impersonator) user belongs. This attribute is provided only if the request uses the run as authorization functionality.
authentication.type
Method used to authenticate the user. Possible values are REALM, API_KEY, TOKEN, ANONYMOUS or INTERNAL.
apikey.id
API key ID returned by the create API key request. This attribute is only provided for authentication using an API key.
apikey.name
API key name provided in the create API key request. This attribute is only provided for authentication using an API key.
authentication.token.name
Name of the service account token. This attribute is only provided for authentication using a service account token.
authentication.token.type
Type of the service account token. This attribute is only provided for authentication using a service account token.
authentication_failed:
user.name
The name of the user that failed authentication. If the request authentication token is invalid or unparsable, this information might be missing.
authentication.token.name
Name of the service account token. This attribute is only provided for authentication using a service account token. If the request authentication token is invalid or unparsable, this information might be missing.
authentication.token.type
Type of the service account token. This attribute is only provided for authentication using a service account token. If the request authentication token is invalid or unparsable, this information might be missing.
realm_authentication_failed:
user.name
The name of the user that failed authentication.
realm
The name of the realm that rejected this authentication. This event is generated for each consulted realm in the chain.
run_as_denied and run_as_granted:
user.roles
The role names as an array of the authenticated user which is being granted or denied the impersonation action. If authenticated as a service account, this is always an empty array.
user.name
The name of the authenticated user which is being granted or denied the impersonation action.
user.realm
The realm name that the authenticated user belongs to.
user.run_as.name
The name of the user as which the impersonation action is granted or denied.
user.run_as.realm
The realm name of that the impersonated user belongs to.
access_granted and access_denied:
user.roles
The role names of the user as an array. If authenticated using an API key, this contains the role names of the API key owner. If authenticated as a service account, this is always an empty array.
user.name
The name of the effective user. This is usually the same as the authenticated user, but if using the run as authorization functionality this instead denotes the name of the impersonated user. If authenticated using an API key, this is the name of the API key owner.
user.realm
Name of the realm to which the effective user belongs. If authenticated using an API key, this is the name of the realm to which the API key owner belongs.
user.run_by.name
This attribute is present only if the request is using the run as authorization functionality and denoted the name of the authenticated user, which is also known as the impersonator.
user.run_by.realm
This attribute is present only if the request is using the run as authorization functionality and denotes the name of the realm that the authenticated (impersonator) user belongs to.
authentication.type
Method used to authenticate the user. Possible values are REALM, API_KEY, TOKEN, ANONYMOUS or INTERNAL.
apikey.id
API key ID returned by the create API key request. This attribute is only provided for authentication using an API key.
apikey.name
API key name provided in the create API key request. This attribute is only provided for authentication using an API key.
authentication.token.name
Name of the service account token. This attribute is only provided for authentication using a service account token.
authentication.token.type
Type of the service account token. This attribute is only provided for authentication using a service account token.