audit-settings.asciidoc 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210
  1. [role="xpack"]
  2. [[auditing-settings]]
  3. === Auditing Security Settings
  4. ++++
  5. <titleabbrev>Auditing Settings</titleabbrev>
  6. ++++
  7. All of these settings can be added to the `elasticsearch.yml` configuration
  8. file. For more information, see
  9. {xpack-ref}/auditing.html[Auditing Security Events].
  10. [[general-audit-settings]]
  11. ==== General Auditing Settings
  12. `xpack.security.audit.enabled`::
  13. Set to `true` to enable auditing on the node. The default value is `false`.
  14. `xpack.security.audit.outputs`::
  15. Specifies where audit logs are output. For example: `[ index, logfile ]`. The
  16. default value is `logfile`, which puts the auditing events in a dedicated
  17. file named `<clustername>_audit.log` on each node.
  18. You can also specify `index`, which puts the auditing events in an {es} index
  19. that is prefixed with `.security_audit_log`. The index can reside on the same
  20. cluster or a separate cluster.
  21. +
  22. For backwards compatibility reasons, if you use the logfile output type, a
  23. `<clustername>_access.log` file is also created. It contains the same
  24. information, but it uses the older (pre-6.5.0) formatting style.
  25. If the backwards compatible format is not required, it should be disabled.
  26. To do that, change its logger level to `off` in the `log4j2.properties` file.
  27. For more information, see <<configuring-logging-levels>>.
  28. +
  29. --
  30. TIP: If the index is unavailable, it is possible for auditing events to
  31. be lost. The `index` output type should therefore be used in conjunction with
  32. the `logfile` output type and the latter should be the official record of events.
  33. --
  34. [[event-audit-settings]]
  35. ==== Audited Event Settings
  36. The events and some other information about what gets logged can be
  37. controlled by using the following settings:
  38. `xpack.security.audit.logfile.events.include`::
  39. Specifies which events to include in the auditing output. The default value is:
  40. `access_denied, access_granted, anonymous_access_denied, authentication_failed, connection_denied, tampered_request, run_as_denied, run_as_granted`.
  41. `xpack.security.audit.logfile.events.exclude`::
  42. Excludes the specified events from the output. By default, no events are
  43. excluded.
  44. `xpack.security.audit.logfile.events.emit_request_body`::
  45. Specifies whether to include the request body from REST requests on certain
  46. event types such as `authentication_failed`. The default value is `false`.
  47. +
  48. --
  49. IMPORTANT: No filtering is performed when auditing, so sensitive data may be
  50. audited in plain text when including the request body in audit events.
  51. --
  52. [[node-audit-settings]]
  53. ==== Local Node Info Settings
  54. `xpack.security.audit.logfile.emit_node_name`::
  55. Specifies whether to include the <<node.name,node name>> as a field in
  56. each audit event.
  57. The default value is `true`.
  58. `xpack.security.audit.logfile.emit_node_host_address`::
  59. Specifies whether to include the node's IP address as a field in each audit event.
  60. The default value is `false`.
  61. `xpack.security.audit.logfile.emit_node_host_name`::
  62. Specifies whether to include the node's host name as a field in each audit event.
  63. The default value is `false`.
  64. `xpack.security.audit.logfile.emit_node_id`::
  65. Specifies whether to include the node id as a field in each audit event.
  66. This is available for the new format only. That is to say, this information
  67. does not exist in the `<clustername>_access.log` file.
  68. Unlike <<node.name,node name>>, whose value might change if the administrator
  69. changes the setting in the config file, the node id will persist across cluster
  70. restarts and the administrator cannot change it.
  71. The default value is `true`.
  72. [[audit-event-ignore-policies]]
  73. ==== Audit Logfile Event Ignore Policies
  74. These settings affect the {stack-ov}/audit-log-output.html#audit-log-ignore-policy[ignore policies]
  75. that enable fine-grained control over which audit events are printed to the log file.
  76. All of the settings with the same policy name combine to form a single policy.
  77. If an event matches all of the conditions for a specific policy, it is ignored
  78. and not printed.
  79. `xpack.security.audit.logfile.events.ignore_filters.<policy_name>.users`::
  80. A list of user names or wildcards. The specified policy will
  81. not print audit events for users matching these values.
  82. `xpack.security.audit.logfile.events.ignore_filters.<policy_name>.realms`::
  83. A list of authentication realm names or wildcards. The specified policy will
  84. not print audit events for users in these realms.
  85. `xpack.security.audit.logfile.events.ignore_filters.<policy_name>.roles`::
  86. A list of role names or wildcards. The specified policy will
  87. not print audit events for users that have these roles. If the user has several
  88. roles, some of which are *not* covered by the policy, the policy will
  89. *not* cover this event.
  90. `xpack.security.audit.logfile.events.ignore_filters.<policy_name>.indices`::
  91. A list of index names or wildcards. The specified policy will
  92. not print audit events when all the indices in the event match
  93. these values. If the event concerns several indices, some of which are
  94. *not* covered by the policy, the policy will *not* cover this event.
  95. [[index-audit-settings]]
  96. ==== Audit Log Indexing Configuration Settings
  97. `xpack.security.audit.index.bulk_size`::
  98. Controls how many audit events are batched into a single write. The default
  99. value is `1000`.
  100. `xpack.security.audit.index.flush_interval`::
  101. Controls how often buffered events are flushed to the index. The default value
  102. is `1s`.
  103. `xpack.security.audit.index.rollover`::
  104. Controls how often to roll over to a new index: `hourly`, `daily`, `weekly`, or
  105. `monthly`. The default value is `daily`.
  106. `xpack.security.audit.index.events.include`::
  107. Specifies the audit events to be indexed. The default value is
  108. `anonymous_access_denied, authentication_failed, realm_authentication_failed, access_granted, access_denied, tampered_request, connection_granted, connection_denied, run_as_granted, run_as_denied`.
  109. See {xpack-ref}/audit-event-types.html[Audit Entry Types] for the
  110. complete list.
  111. `xpack.security.audit.index.events.exclude`::
  112. Excludes the specified auditing events from indexing. By default, no events are
  113. excluded.
  114. `xpack.security.audit.index.events.emit_request_body`::
  115. Specifies whether to include the request body from REST requests on certain
  116. event types such as `authentication_failed`. The default value is `false`.
  117. `xpack.security.audit.index.settings`::
  118. Specifies settings for the indices that the events are stored in. For example,
  119. the following configuration sets the number of shards and replicas to 1 for the
  120. audit indices:
  121. +
  122. --
  123. [source,yaml]
  124. ----------------------------
  125. xpack.security.audit.index.settings:
  126. index:
  127. number_of_shards: 1
  128. number_of_replicas: 1
  129. ----------------------------
  130. --
  131. +
  132. --
  133. NOTE: These settings apply to the local audit indices, as well as to the
  134. <<remote-audit-settings, remote audit indices>>, but only if the remote cluster
  135. does *not* have {security} installed, or the {es} versions are different.
  136. If the remote cluster has {security} installed, and the versions coincide, the
  137. settings for the audit indices there will take precedence,
  138. even if they are unspecified (i.e. left to defaults).
  139. --
  140. [[remote-audit-settings]]
  141. ==== Remote Audit Log Indexing Configuration Settings
  142. To index audit events to a remote {es} cluster, you configure the following
  143. `xpack.security.audit.index.client` settings:
  144. `xpack.security.audit.index.client.hosts`::
  145. Specifies a comma-separated list of `host:port` pairs. These hosts should be
  146. nodes in the remote cluster. If you are using default values for the
  147. <<common-network-settings,`transport.tcp.port`>> setting, you can omit the
  148. `port` value. Otherwise, it must match the `transport.tcp.port` setting.
  149. `xpack.security.audit.index.client.cluster.name`::
  150. Specifies the name of the remote cluster.
  151. `xpack.security.audit.index.client.xpack.security.user`::
  152. Specifies the `username:password` pair that is used to authenticate with the
  153. remote cluster. This user must have authority to create the `.security-audit`
  154. index on the remote cluster.
  155. If the remote {es} cluster has Transport Layer Security (TLS/SSL) enabled, you
  156. must set the following setting to `true`:
  157. `xpack.security.audit.index.client.xpack.security.transport.ssl.enabled`::
  158. Used to enable or disable TLS/SSL for the transport client that forwards audit
  159. logs to the remote cluster. The default is `false`.
  160. You must also specify the information necessary to access certificates. See
  161. <<auditing-tls-ssl-settings>>.
  162. You can pass additional settings to the remote client by specifying them in the
  163. `xpack.security.audit.index.client` namespace. For example, you can add
  164. <<modules-transport,transport settings>> and
  165. <<tcp-settings,advanced TCP settings>> in that namespace. To allow the remote
  166. client to discover all of the nodes in the remote cluster you can specify the
  167. `client.transport.sniff` setting:
  168. [source,yaml]
  169. ----------------------------
  170. xpack.security.audit.index.client.transport.sniff: true
  171. ----------------------------