# Filebeat =\> logstash index

**URL:** <https://discuss.elastic.co/t/filebeat-logstash-index/81201>\
**Category:** Logstash\
**Created:** [April 4, 2017, 6:38pm UTC](https://discuss.elastic.co/t/filebeat-logstash-index/81201 "2017-04-04T18:38:37Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![craftytech1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craftytech1/32/17067_2.png) [@craftytech1](https://discuss.elastic.co/u/craftytech1)\
**Post date:** [April 4, 2017, 6:38pm UTC](https://discuss.elastic.co/t/filebeat-logstash-index/81201/1 "2017-04-04T18:38:37Z")

</div>

I configured my filebeat client as per the instructions:  
[https://www.elastic.co/guide/en/beats/filebeat/current/configuration-filebeat-options.html](https://www.elastic.co/guide/en/beats/filebeat/current/configuration-filebeat-options.html)

I also configured logstash as per the instructions as well:  
[https://www.elastic.co/guide/en/beats/filebeat/current/logstash-output.html](https://www.elastic.co/guide/en/beats/filebeat/current/logstash-output.html)

i.e,  
output {  
elasticsearch {  
hosts =\> ["[http://localhost:9200](http://localhost:9200)"]  
index =\> "%{[@metadata][beat]}-%{+YYYY.MM.dd}"  
document\_type =\> "%{[@metadata][type]}"  
}  
}

however, the indexes continue to get created as 'filebeat-\*'.. I went ahead and created another template for my custom index, pretty the same as the filebeat index.  
i.e,

> <https://github.com/telminov/docker-elk-server/blob/master/elasticsearch/filebeat-index-template.json>

What can I do to get logstash to create an index that matches the document\_type from filebeat? so far nothing that I've done seems to work.

Thanks,

---

<div class="post-metadata">

**Author:** ![devsibwarra](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/devsibwarra/32/17066_2.png) [@devsibwarra](https://discuss.elastic.co/u/devsibwarra)\
**Post date:** [April 4, 2017, 6:55pm UTC](https://discuss.elastic.co/t/filebeat-logstash-index/81201/2 "2017-04-04T18:55:17Z")

</div>

> [@craftytech1](#):
>
> output { elasticsearch { hosts =\> ["[http://localhost:9200](http://localhost:9200)"] index =\> "%{[@metadata][beat]}-%{+YYYY.MM.dd}" document\_type =\> "%{[@metadata][type]}" }}

In your example, the `output.elasticsearch.index` setting is using `%{[@metadata][beat]}-` which would map to `filebeat-`, `metricbeat-`, etc. Try changing that to `%{[@metadata][type]}-` or some static content that your index template is setup to match

---

<div class="post-metadata">

**Author:** ![craftytech1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/craftytech1/32/17067_2.png) [@craftytech1](https://discuss.elastic.co/u/craftytech1)\
**Post date:** [April 4, 2017, 7:04pm UTC](https://discuss.elastic.co/t/filebeat-logstash-index/81201/3 "2017-04-04T19:04:32Z")

</div>

that works! Thanks!

---

<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:** [May 2, 2017, 7:04pm UTC](https://discuss.elastic.co/t/filebeat-logstash-index/81201/4 "2017-05-02T19:04:35Z")

</div>

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