How to use the index specified in Filebeat in logstash.yml?

Hey there,

I am using Filebeat to send log files over to my Logstash with the following configurations:

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???"
  }
}

In filebeat.yml, I am specifying an index ("custom index"). How can I set the same index in my logstash.yml to be sent to Elasticsearch?

Can anyone help?

It seems like, very seldom does anyone answer questions :neutral_face: Guess I'll just go to StackOverflow from now on!

Anyway, the answer is:

output {
  elasticsearch {
    hosts => [ "localhost:9200" ]
    index => "%{[@metadata][beat]}"
  }
}

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.