【问题标题】:how to set correct timestring in metricbeat index?如何在 metricbeat 索引中设置正确的时间字符串?
【发布时间】:2021-03-11 21:32:25
【问题描述】:

我试图在 elasticsearch 索引中设置自定义 metricbeat 索引。

当我像下面这样添加到 metricbeat.yml 文件时

        index: "metricbeat-%{[agent.version]}-%{+yyyy-MM-dd}"
      setup.template:
        name: "metricbeat"
        pattern: "metricbeat-%{[agent.version]}-%{+yyyy-MM-dd}"

生成的索引是metricbeat-7.8.0-2021.03.11-000001。但是curator中的时间字符串'%Y.%m.%d'不匹配,无法清除索引。

如何使索引从metricbeat-7.8.0-2021.03.11-000001变为metricbeat-7.8.0-2021.03.11

我什至试过这样

        index: "metricbeat-{now/d}"
      setup.template:
        name: "metricbeat"
        pattern: "metricbeat-{now/d}"

但同样的索引模式。请帮忙。

更新:

策展人配置

Data
====
action_file.yml:
----
---
actions:
  1:
    action: delete_indices
    description: "Clean up ES by deleting old indices"
    options:
      timeout_override:
      continue_if_exception: False
      disable_action: False
      ignore_empty_list: True
    filters:
    - filtertype: pattern
      kind: regex
      value: '^(metricbeat-).*$'
    - filtertype: age
      source: name
      direction: older
      timestring: '%Y.%m.%d'
      unit: days
      unit_count: 7
      field:
      stats_result:
      epoch:
      exclude: False
config.yml:
----
---
client:
  hosts:
    - elasticsearch-master.paas.svc
  port: 9200
  # url_prefix:
  # use_ssl: True
  # certificate:
  # client_cert:
  # client_key:
  # ssl_no_validate: True
  # http_auth:
  # timeout: 30
  # master_only: False
logging:
  loglevel: DEBUG
#   logfile:
#   logformat: default
#   blacklist: ['elasticsearch', 'urllib3']

【问题讨论】:

  • 也许如果您在 Curator 中分​​享了您尝试使用的内容,我可以帮助它工作吗?
  • 正在尝试使用 curator 清除 metricbeat 索引。但是索引没有被清除。
  • 请让我澄清一下:我需要知道您的 Curator 配置是什么样子才能提供帮助。这就是我所说的“你试图在 Curator 中使用的东西”的意思。
  • 我已经用 config 编辑了问题。

标签: elasticsearch metricbeat elasticsearch-curator


【解决方案1】:

索引模式metricbeat-7.8.0-2021.03.11-000001 表示 metricbeat 正在使用翻转索引。它附有创建索引的日期和递增的数字。这也意味着您可能将 ILM 政策附加到您的展期指数中。因此,您应该在文档中阅读有关 ILM and Curator 的信息。要更正这些被过滤的索引,您必须在配置中将allow_ilm_indices: true 添加到options

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-04
    • 1970-01-01
    • 2013-08-17
    • 2019-03-04
    • 2017-04-15
    • 1970-01-01
    相关资源
    最近更新 更多