# Filebeat configuration to create different elasticsearch index

**URL:** https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607
**Category:** Beats
**Tags:** filebeat
**Created:** [April 18, 2018, 10:15pm UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607 "2018-04-18T22:15:55Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Ferdous\_Shibly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ferdous_shibly/32/23470_2.png) [@Ferdous\_Shibly](https://discuss.elastic.co/u/Ferdous_Shibly)
#### Post date: [April 18, 2018, 10:15pm UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607/1 "2018-04-18T22:15:55Z")

</div>

Hi,

We are trying to configure Filebeat to send logs to Elasticsearch. We want to create different index than the default one. Here is the configuration

```
- input_type: log
  paths:
     - /var/log/application1/*.err
     - /var/log/application1/*.log
  tags: "kapacitor-logs"
  document_type: log
  tail_files: true
  
  output.elasticsearch:
    hosts: ["localhost:9200"]
    protocol: "https"
    output.elasticsearch.index: "application1-%{+yyyy.MM.dd}"
    setup.template.name: "application1"
    setup.template.pattern: "application1-*"
    setup.dashboards.index: "application1-*"

```

We found logs in filebeat-6.2.4-2018.04.18 always. How can we send logs to application1-6.2.4-2018.04.18 index of Elasticsearch.

Thanks  
Ferdous Shibly

---

<div class="post-metadata">

### Author: ![lynx](https://avatars.discourse-cdn.com/v4/letter/l/7ab992/32.png) [@lynx](https://discuss.elastic.co/u/lynx)
#### Post date: [April 19, 2018, 3:58am UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607/2 "2018-04-19T03:58:55Z")

</div>

I have the same issue as well, i tried to send the logs using filebeats to logstash and have a grok filter to create the index but not successful.

I read that we can do it by document\_type but seems thats is deprecated.

* * *

filebeat.prospectors:

- type: log  
paths:  
- /var/log/messages  
fields:  
document\_type: vlm

- type: log  
enabled: true  
paths:

* * *

---

<div class="post-metadata">

### Author: ![harshbajaj16](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harshbajaj16/32/44970_2.png) [@harshbajaj16](https://discuss.elastic.co/u/harshbajaj16)
#### Post date: [April 19, 2018, 8:29am UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607/3 "2018-04-19T08:29:26Z")

</div>

Hi,

could you please try with below format.

> output.elasticsearch:  
> hosts: ["[http://localhost:9200](http://localhost:9200)"]  
> index: "application1-%{+yyyy.MM.dd}"

Thanks,  
Harsh

---

<div class="post-metadata">

### Author: ![ruflin](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ruflin/32/3116_2.png) [@ruflin](https://discuss.elastic.co/u/ruflin)
#### Post date: [April 19, 2018, 9:11am UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607/4 "2018-04-19T09:11:56Z")

</div>

As @harshbajaj16 mentioned it looks like the config option is wrong + the indentation. Here are the docs: [https://www.elastic.co/guide/en/beats/filebeat/current/elasticsearch-output.html](https://www.elastic.co/guide/en/beats/filebeat/current/elasticsearch-output.html)

---

<div class="post-metadata">

### Author: ![Ferdous\_Shibly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ferdous_shibly/32/23470_2.png) [@Ferdous\_Shibly](https://discuss.elastic.co/u/Ferdous_Shibly)
#### Post date: [April 19, 2018, 2:26pm UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607/5 "2018-04-19T14:26:29Z")

</div>

@rufin and @harshbajaj16 I have updated my configuration accordingly but when I restart filebeat, it is giving me the following error message.

```
2018-04-19T10:22:37.587-0400	ERROR	instance/beat.go:667	Exiting: setup.template.name and setup.template.pattern have to be set if index name is modified.
Exiting: setup.template.name and setup.template.pattern have to be set if index name is modified.

```

Here is my updated configuration

```
output.elasticsearch:
  hosts: ["localhost:9200"]
  protocol: "https"
  index: "application1-%{+yyyy.MM.dd}"
```

---

<div class="post-metadata">

### Author: ![harshbajaj16](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harshbajaj16/32/44970_2.png) [@harshbajaj16](https://discuss.elastic.co/u/harshbajaj16)
#### Post date: [April 20, 2018, 3:55am UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607/6 "2018-04-20T03:55:40Z")

</div>

Hi,

when you set index name Beats force you to also set template and pattern. However, If you don't want to set this just put below line in your config file.

> setup.template.enabled: false

Thanks,  
Harsh

---

<div class="post-metadata">

### Author: ![Ferdous\_Shibly](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/ferdous_shibly/32/23470_2.png) [@Ferdous\_Shibly](https://discuss.elastic.co/u/Ferdous_Shibly)
#### Post date: [April 30, 2018, 4:08pm UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607/7 "2018-04-30T16:08:58Z")

</div>

> [@harshbajaj16](#):
>
> setup.template.enabled: false

setup.template.enabled: false worked, 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 28, 2018, 4:09pm UTC](https://discuss.elastic.co/t/filebeat-configuration-to-create-different-elasticsearch-index/128607/8 "2018-05-28T16:09:06Z")

</div>

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