logstash.yml如何使用Filebeat中指定的索引?
How to use the index specified in Filebeat in logstash.yml?
我正在使用 Filebeat
将日志文件发送到我的 Logstash
,配置如下:
filebeat.inputs:
- type: log
enabled: true
paths:
- ${PWD}/filebeat-volume/data/*.txt
output.logstash:
enabled: true
hosts: ["elk:5044"]
index: "custom-index"
setup.kibana:
host: "localhost:5601"
和
input {
beats {
port => "5044"
}
}
output {
elasticsearch {
hosts => [ "localhost:9200" ]
index => "<WHAT SHOULD GO HERE???>"
}
}
在 filebeat.yml
中,我指定了一个索引 ("custom index")。如何在我的 logstash.yml
中设置相同的索引以发送到 Elasticsearch
?
我现在明白你想要什么了,你应该使用以下输出配置设置 Logstash,这样它将把 filebeat 中设置的索引传递给 Elasticsearch。
output {
elasticsearch {
hosts => [ "localhost:9200" ]
index => "%{[@metadata][beat]}"
}
}
我正在使用 Filebeat
将日志文件发送到我的 Logstash
,配置如下:
filebeat.inputs:
- type: log
enabled: true
paths:
- ${PWD}/filebeat-volume/data/*.txt
output.logstash:
enabled: true
hosts: ["elk:5044"]
index: "custom-index"
setup.kibana:
host: "localhost:5601"
和
input {
beats {
port => "5044"
}
}
output {
elasticsearch {
hosts => [ "localhost:9200" ]
index => "<WHAT SHOULD GO HERE???>"
}
}
在 filebeat.yml
中,我指定了一个索引 ("custom index")。如何在我的 logstash.yml
中设置相同的索引以发送到 Elasticsearch
?
我现在明白你想要什么了,你应该使用以下输出配置设置 Logstash,这样它将把 filebeat 中设置的索引传递给 Elasticsearch。
output {
elasticsearch {
hosts => [ "localhost:9200" ]
index => "%{[@metadata][beat]}"
}
}