亲,只收二进制

filbeat 进行多日志读取,使用indices:设置多索引,但是只能第一个索引创建成功,第二条就变成默认的filebeat-XXX的索引了

Beats | 作者 moses3000 | 发布于2021年11月29日 | 阅读数:1599

环境: CentOS 7.6
elk 版本 V7.7.1
 我在filebeat input中设置读取多个目录下的日志,配置如下:
filebeat.inputs:

# Each - is an input. Most options can be set at the input level, so
# you can use different inputs for various configurations.
# Below are the input specific configurations.
########################################
# tas_log
#########################################
- type: log

# Change to true to enable this input configuration.
enabled: true

# Paths that should be crawled and fetched. Glob based paths.
paths:
#- /var/log/*.log
- "/home/ats/DX_ats_log/*.log"
#- c:\programdata\elasticsearch\logs\*
tags: ["atsAdapter"]
##########################################
#TccAdapter.log
##########################################
- type: log

# Change to true to enable this input configuration.
enabled: true

# Paths that should be crawled and fetched. Glob based paths.
paths:
#- /var/log/*.log
- "/home/Tcclog/*.log"
#- c:\programdata\elasticsearch\logs\*
tags: ["tccadapter"]

在Elasticsearch output 中为每个日志创建一个不同名字的索引,配置如下:
#-------------------------- Elasticsearch output ------------------------------
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["192.168.100.110:9200"]
indices:
- index: "atsAdapter-%{+yyyy.mm.dd}"
when.contains:
tags: "atsAdapter"
- index: "tccAdapter-%{+yyyy.mm.dd}"
when.contains:
tags: "tccadapter"

# Protocol - either `http` (default) or `https`.
#protocol: "https"

# Authentication credentials - either API key or username/password.
#api_key: "id:api_key"
username: "elastic"
password: "123456"

但是结果是只有atsAdapter-%{+yyyy.mm.dd} 按规定的名称生成了,第二个索引没有按照"tccAdapter-%{+yyyy.mm.dd}"规则生成,而是生成了一个默认的filebeats的索引
请问这个问题该怎么搞啊?
已邀请:

Acoral

赞同来自:

我的这个配置是可以的,你可以试试。

要回复问题请先登录注册