Hi All
Below are my config files for 2 filebeats & logstash.. I set the fields index=my_data_1 in filebeat config. & send to logstash.. in the logstash i want use the value passed in fields.index from filebeat to use it for indexing when sent to elastic search.. so that both filebeat agents using the same logstash can send data to different index names.
But, [fields][index] is not working.. im unable to get the value set in filebeat..
With the below configuration the index name in created in ES cluster is [fields][index]-2017.03.23
"[@metadata][index]" => "[fields][index]" ==> not working
Logstash configs:
```
input {
beats {
port => "9997"
}
}
filter {
mutate {
replace => {
"[@metadata][index]" => "[fields][index]" ===> This is not working..
}
}
}
output {
elasticsearch {
hosts => ["10.205.233.191:8089","10.205.236.248:8089","10.205.235.211:8089"]
index => "%{[@metadata][index]}-%{+YYYY.MM.dd}"
#document_type => "%{[@metadata][type]}"
}
}
```
File beat -1 config:
filebeat.prospectors:
- input_type: log
paths:
- <path to file>
fields:
index: my_data
output.logstash:
# The Logstash hosts
hosts: ["localhost:9997"]
File beat -2 config:
```
filebeat.prospectors:
- input_type: log
paths:
- <path to file>
fields:
index: my_data_2
output.logstash:
# The Logstash hosts
hosts: ["localhost:9997"]
```