【问题标题】:Filebeat 7.9.3 change index is not working and it always creates default filebeat-7.9.3-2020.11.04-000001Filebeat 7.9.3 更改索引不起作用,它始终创建默认 filebeat-7.9.3-2020.11.04-000001
【发布时间】:2020-11-04 14:05:28
【问题描述】:

我试过这个 https://www.elastic.co/guide/en/beats/filebeat/master//change-index-name.html#change-index-namehttps://discuss.elastic.co/t/index-management-change-index-name-in-filebeat/202876

在 windows 环境中使用 filebeat-7.9.3 和 kibana-7.9.2。但是在 Kibana 中它不会创建我在 filebeat.yml 中提到的索引名

# ============================== Filebeat inputs ===============================

filebeat.inputs:
- type: log
    - C:\FREESOFT\myfilebeatlogs\*


# ============================== Filebeat modules ==============================

filebeat.config.modules:
  # Glob pattern for configuration loading
  path: ${path.config}/modules.d/*.yml

  # Set to true to enable config reloading
  reload.enabled: false

# ======================= Elasticsearch template setting =======================

setup.template.settings:
  index.number_of_shards: 1
  #index.codec: best_compression
  #_source.enabled: false

# ================================== Outputs ===================================

# Configure what output to use when sending the data collected by the beat.

# ---------------------------- Elasticsearch Output ----------------------------
output.elasticsearch:
  # Array of hosts to connect to.
  hosts: ["localhost:9200"]
index: "customindexname-%{+yyyy.MM.dd}"

我也试过

index: "myindexname-%{+yyyy.MM.dd}"
setup.template.enabled: false
setup.template.name: "myindexname"
setup.template.pattern: "myindexname-*"

请帮我解决这个问题,我想创建一个自定义索引并从 Filebeat 向其中插入数据。堆栈中过去的问题并没有解决我的问题。

【问题讨论】:

    标签: elasticsearch kibana filebeat


    【解决方案1】:

    以下配置适用于我并创建我想要的索引名称

    filebeat.inputs:
      - type: log
        paths:
          - "/var/log/*.log"
    setup.ilm.enabled: false
    setup.template.overwrite: true
    output.elasticsearch:
      hosts: ["<my-es-host>"]
      index: "foo-%{+yyyy.MM}"
      username: '${ELASTICSEARCH_USERNAME:elastic}'
      password: '${ELASTICSEARCH_PASSWORD:elastic}'
    
    setup.template:
      name: 'foo'
      pattern: 'foo-*'
      enabled: false
    

    【讨论】:

    • 非常感谢,它成功了,我不得不将 ' 更改为“因为 ' 没有找到预期的密钥”,这在 stackoverflow.com/questions/61415359/… 中提到
    • @SameeraDeSilva 很高兴它起作用了,我很有帮助:)
    猜你喜欢
    • 2019-04-25
    • 2019-02-04
    • 2022-01-18
    • 2023-01-03
    • 2021-01-10
    • 2017-05-25
    • 1970-01-01
    • 2022-01-08
    • 1970-01-01
    相关资源
    最近更新 更多