clear-service-token-caches.asciidoc 2.3 KB

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