filebeat未使用我的名字创建索引

问题描述 投票:0回答:2

我正在使用文件信号将我的应用程序日志发送到Elasticsearch,并直接连接到我的Elasticsearch以发送日志。

我的文件拍子配置

filebeat.config:
  modules:
    path: ${path.config}/modules.d/*.yml
    reload.enabled: false

filebeat.inputs:
  - type: log
    paths:
      - "/var/log/*.log"
setup.ilm.enabled: false
setup.template.overwrite: true
output.elasticsearch:
  hosts: ["aws-es:443"]
  output.elasticsearch.index: "myapp-%{[agent.version]}-%{+yyyy.MM.dd}"
  username: '${ELASTICSEARCH_USERNAME:}'
  password: '${ELASTICSEARCH_PASSWORD:}

[请注意,在output.elasticsearch.index:中,我给myapp作为我在Elasticsearch中的索引名称的前缀,但是filebeat正在使用filebeat-7.7.0-2020.05.31名称创建索引,即使用自己的名称filebeat作为前缀,我不想有多个应用程序,并希望为其创建单独的索引。

elasticsearch filebeat
2个回答
0
投票

您的财产名称错误。它是output.elasticsearch.output.elasticsearch.index,但只能是output.elasticsearch.index将您的配置更改为

output.elasticsearch:
  hosts: ["aws-es:443"]
  index: "myapp-%{[agent.version]}-%{+yyyy.MM.dd}"
  username: '${ELASTICSEARCH_USERNAME:}'
  password: '${ELASTICSEARCH_PASSWORD:}

0
投票

您需要设置setup.template.namesetup.template.pattern如错误消息中所述。请在您的filebeat.yml中的其他行下面添加。

setup.template:名称:“ myapp”模式:“ myapp- *”已启用:false

现在填写完整的filebeat.yml应该看起来像

filebeat.config:模块:路径:$ {path.config}/modules.d/ * .ymlreload.enabled:假

  filebeat.inputs:
    -type: log
  paths:
    -"/var/log/*.log"
  setup.ilm.enabled: false
  setup.template.overwrite: true
  output.elasticsearch:
    hosts: ["aws-es:443"]
  output.elasticsearch.index: "myapp-%{[agent.version]}-%{+yyyy.MM.dd}"
  username: '${ELASTICSEARCH_USERNAME:}'
  password: '${ELASTICSEARCH_PASSWORD:}

setup.template:名称:“ myapp”模式:“ myapp- *”已启用:false

© www.soinside.com 2019 - 2024. All rights reserved.