Hi team,
I am trying to push the nginx logs using filebeat to elasticsearch.
I wanted to created multiple indexes based on data logged in my file.
For example : i have a field of response time that gets logged into the log file. But for some cases the value comes as "-".
So what i want to do is push the data to two different indexes of elasticsearch based on the field value.
I have gone through the documentation and question blog and had found something useful and tried to do the same. Here is a link https://discuss.elastic.co/t/set-indices-based-on-a-field-value/69579 and https://www.elastic.co/guide/en/beats/filebeat/5.3/elasticsearch-output.html#_indices.
My configuration is shown here :
output.elasticsearch:
# Array of hosts to connect to.
hosts: ["localhost:9200"]
index: "nginx-access-%{[beat.version]}-%{+yyyy.MM.dd}"
indices:
- index: "abc-%{[beat.version]}-%{+yyyy.MM.dd}"
when.equals:
nginx.access.upstr_resp_time: "-"
setup.template.settings:
index.number_of_shards: 3
#index.codec: best_compression
#_source.enabled: false
setup.template.name: "nginx-access"
setup.template.pattern: "nginx-access-*"
setup.template.name: "abc"
setup.template.pattern: "abc-*"
setup.template.enable: true
setup.template.overwrite: false
As you can see i wanted to push the data to index nginx-access-* by default and if the response time have "-" will send to abc-*. In my log file their are 14 data. Now i want to see all those data in my kibana. So when i click on discover i can see only one index being displayed. Is their something wrong i am doing. Please help me with the issue
Note
The index shown on kibana show 13 data and the another 1 data that is left over have response time value as "_" which is not shown on kibana.