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

**URL:** <https://discuss.elastic.co/t/how-to-use-the-index-specified-in-filebeat-in-logstash-yml/144992>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [August 18, 2018, 7:44am UTC](https://discuss.elastic.co/t/how-to-use-the-index-specified-in-filebeat-in-logstash-yml/144992 "2018-08-18T07:44:52Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![mhyousefi](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mhyousefi](https://discuss.elastic.co/u/mhyousefi)\
**Post date:** [August 18, 2018, 7:44am UTC](https://discuss.elastic.co/t/how-to-use-the-index-specified-in-filebeat-in-logstash-yml/144992/1 "2018-08-18T07:44:52Z")

</div>

Hey there,

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

```auto
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"

```

```auto
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`?

---

<div class="post-metadata">

**Author:** ![mhyousefi](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mhyousefi](https://discuss.elastic.co/u/mhyousefi)\
**Post date:** [August 19, 2018, 8:04pm UTC](https://discuss.elastic.co/t/how-to-use-the-index-specified-in-filebeat-in-logstash-yml/144992/2 "2018-08-19T20:04:15Z")

</div>

Can anyone help?

---

<div class="post-metadata">

**Author:** ![mhyousefi](https://avatars.discourse-cdn.com/v4/letter/m/2acd7d/32.png) [@mhyousefi](https://discuss.elastic.co/u/mhyousefi)\
**Post date:** [August 21, 2018, 5:57am UTC](https://discuss.elastic.co/t/how-to-use-the-index-specified-in-filebeat-in-logstash-yml/144992/3 "2018-08-21T05:57:45Z")

</div>

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

Anyway, the answer is:

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

```

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [September 18, 2018, 5:57am UTC](https://discuss.elastic.co/t/how-to-use-the-index-specified-in-filebeat-in-logstash-yml/144992/4 "2018-09-18T05:57:46Z")

</div>

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