indices.asciidoc 5.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. [role="xpack"]
  2. [[config-monitoring-indices]]
  3. == Configuring data streams/indices for monitoring
  4. Monitoring data is stored in data streams or indices in {es}. The default data
  5. stream or index settings may not work for your situation. For example, you might
  6. want to change index lifecycle management (ILM) settings, add custom mappings,
  7. or change the number of shards and replicas. The steps to change these
  8. settings depend on the monitoring method:
  9. * <<config-monitoring-data-streams-elastic-agent>>
  10. * <<config-monitoring-data-streams-metricbeat-8>> (the default for version 8
  11. {ess} deployments on {ecloud})
  12. * <<config-monitoring-indices-metricbeat-7-internal-collection>>
  13. IMPORTANT: Changing mappings or settings can cause your monitoring dashboards to
  14. stop working correctly.
  15. [[config-monitoring-data-streams-elastic-agent]]
  16. === Configuring data streams created by {agent}
  17. When <<configuring-elastic-agent,monitoring using {agent}>>, data is stored in a
  18. set of data streams named
  19. `metrics-{product}.stack_monitoring.{dataset}-{namespace}`. For example:
  20. `metrics-elasticsearch.stack_monitoring.shard-default`.
  21. The settings and mappings for these data streams are determined by an index
  22. template named `metrics-{product}.stack_monitoring.{dataset}`. For example:
  23. `metrics-elasticsearch.stack_monitoring.shard`.
  24. To change the settings of each data stream, edit the
  25. `metrics-{product}.stack_monitoring.{dataset}@custom` component template that
  26. already exists. You can do this in {kib}:
  27. * Navigate to *Stack Management* > *Index Management* > *Component Templates*.
  28. * Search for the component template.
  29. * Select the *Edit* action.
  30. You can also use the {es} API:
  31. * Retrieve the component template using the <<getting-component-templates,get
  32. component template API>>.
  33. * Edit the component template.
  34. * Store the updated component template using the <<indices-component-template,
  35. update component template API>>.
  36. After changing the component template, the updated settings are only applied
  37. to the data stream's new backing indices.
  38. <<manually-roll-over-a-data-stream,Roll over the data stream>> to immediately
  39. apply the updated settings to the data stream’s write index.
  40. [[config-monitoring-data-streams-metricbeat-8]]
  41. === Configuring data streams created by {metricbeat} 8
  42. When <<configuring-metricbeat,monitoring using {metricbeat} 8>>, data is stored
  43. in a set of data streams called `.monitoring-{product}-8-mb`. For example:
  44. `.monitoring-es-8-mb`.
  45. The settings and mappings for these data streams are determined by an index
  46. template named `.monitoring-{product}-mb`. For example: `.monitoring-es-mb`. You
  47. can alter the settings of each data stream by cloning this index template and
  48. editing it.
  49. WARNING: You need to repeat this procedure when upgrading the {stack} to get the
  50. latest updates to the default monitoring index templates.
  51. You can clone index templates in {kib}:
  52. * Navigate to *Stack Management* > *Index Management* > *Index Templates*.
  53. * From the *View* dropdown, select *System templates*.
  54. * Search for the index template.
  55. * Select the *Clone* action.
  56. * Change the name, for example into `custom_monitoring`.
  57. * Set the priority to `500`, to ensure it overrides the default index template.
  58. * Specify the settings you want to change in the `settings` section.
  59. * Save the cloned template.
  60. You can also use the {es} API:
  61. * Retrieve the index template using the <<indices-get-template,get index
  62. template API>>.
  63. * Edit the index template: set the template `priority` to `500`, and specify the
  64. settings you want to change in the `settings` section.
  65. * Store the updated index template under a different name, for example
  66. `custom_monitoring`, using the
  67. <<indices-put-template,create index template API>>.
  68. NOTE: {metricbeat} 8 uses <<index-templates,composable templates>>, rather than
  69. legacy templates.
  70. After changing the index template, the updated settings are only applied to the
  71. data stream's new backing indices.
  72. <<manually-roll-over-a-data-stream,Roll over the data stream>> to immediately
  73. apply the updated settings to the data stream’s write index.
  74. [[config-monitoring-indices-metricbeat-7-internal-collection]]
  75. === Configuring indices created by {metricbeat} 7 or internal collection
  76. When monitoring <<configuring-metricbeat,using {metricbeat} 7>> or
  77. {filebeat-ref}/monitoring-internal-collection.html[internal collection], data is
  78. stored in a set of indices called either:
  79. * `.monitoring-{product}-7-mb-{date}`, when using {metricbeat} 7.
  80. * `.monitoring-{product}-7-{date}`, when using internal collection.
  81. The settings and mappings for these indices are determined by
  82. <<indices-templates-v1,legacy index templates>> named `.monitoring-{product}`.
  83. You can retrieve these templates in {kib} by navigating to *Stack Management* >
  84. *Index Management* > *Index Templates*, or by using the {es} `_template` API:
  85. [source,console]
  86. ----
  87. GET /_template/.monitoring-*
  88. ----
  89. To change the settings of the indices, add a custom index template. You can do
  90. that in {kib}, or using the {es} API:
  91. * Set `index_patterns` to match the `.monitoring-{product}-7-*` indices.
  92. * Set the template `order` to `1`. This ensures your template is
  93. applied after the default template, which has an order of 0.
  94. * Specify the `number_of_shards` and/or `number_of_replicas` in the `settings`
  95. section.
  96. [source,console]
  97. ----
  98. PUT /_template/custom_monitoring
  99. {
  100. "index_patterns": [".monitoring-beats-7-*", ".monitoring-es-7-*", ".monitoring-kibana-7-*", ".monitoring-logstash-7-*"],
  101. "order": 1,
  102. "settings": {
  103. "number_of_shards": 5,
  104. "number_of_replicas": 2
  105. }
  106. }
  107. ----
  108. After changing the index template, the updated settings are only applied to new
  109. indices.
  110. ////
  111. [source,console]
  112. ----
  113. DELETE /_template/custom_monitoring
  114. ----
  115. // TEST[continued]
  116. ////