clear-service-token-caches.asciidoc 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. [role="xpack"]
  2. [[security-api-clear-service-token-caches]]
  3. === Clear service account token caches API
  4. ++++
  5. <titleabbrev>Clear service account token caches</titleabbrev>
  6. ++++
  7. .New API reference
  8. [sidebar]
  9. --
  10. For the most up-to-date API details, refer to {api-es}/group/endpoint-security[Security APIs].
  11. --
  12. Evicts a subset of all entries from the <<service-accounts,service account>>
  13. token caches.
  14. [[security-api-clear-service-token-caches-request]]
  15. ==== {api-request-title}
  16. `POST /_security/service/{namespace}/{service}/credential/token/{token_name}/_clear_cache`
  17. [[security-api-clear-service-token-caches-prereqs]]
  18. ==== {api-prereq-title}
  19. * To use this API, you must have at least the `manage_security`
  20. <<privileges-list-cluster,cluster privilege>>.
  21. [[security-api-clear-service-token-caches-desc]]
  22. ==== {api-description-title}
  23. Two, separate caches exist for service account tokens: one cache for tokens
  24. backed by the `service_tokens` file, and another for tokens backed by the
  25. `.security` index. This API clears matching entries from both caches.
  26. The cache for service account tokens backed by the `.security` index is cleared
  27. automatically on state changes of the security index. The cache for tokens
  28. backed by the `service_tokens` file is cleared automatically on file changes.
  29. See <<service-accounts,Service accounts>> for more information.
  30. [[security-api-clear-service-token-caches-path-params]]
  31. ==== {api-path-parms-title}
  32. `namespace`::
  33. (Required, string) Name of the namespace.
  34. `service`::
  35. (Required, string) Name of the service name.
  36. `token_name`::
  37. (Required, string) Comma-separated list of token names to evict from the
  38. service account token caches. Use a wildcard (`*`) to evict all tokens that
  39. belong to a service account. Does not support other wildcard patterns.
  40. [[security-api-clear-service-token-caches-example]]
  41. ==== {api-examples-title}
  42. The following request clears the service account token cache for the `token1`
  43. token:
  44. [source,console]
  45. ----
  46. POST /_security/service/elastic/fleet-server/credential/token/token1/_clear_cache
  47. ----
  48. Specify multiple token names as a comma-separated list:
  49. [source,console]
  50. ----
  51. POST /_security/service/elastic/fleet-server/credential/token/token1,token2/_clear_cache
  52. ----
  53. To clear all entries from the service account token caches, use a wildcard
  54. (`*`) in place of token names:
  55. [source,console]
  56. ----
  57. POST /_security/service/elastic/fleet-server/credential/token/*/_clear_cache
  58. ----