# How can I create index per hostname per day?

**URL:** <https://discuss.elastic.co/t/how-can-i-create-index-per-hostname-per-day/153992>\
**Category:** Logstash\
**Created:** [October 25, 2018, 11:31am UTC](https://discuss.elastic.co/t/how-can-i-create-index-per-hostname-per-day/153992 "2018-10-25T11:31:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![09958a6c84c61fe52414](https://avatars.discourse-cdn.com/v4/letter/0/cdc98d/32.png) [@09958a6c84c61fe52414](https://discuss.elastic.co/u/09958a6c84c61fe52414)\
**Post date:** [October 25, 2018, 11:31am UTC](https://discuss.elastic.co/t/how-can-i-create-index-per-hostname-per-day/153992/1 "2018-10-25T11:31:09Z")

</div>

Hi all!  
Now I am using logstash config that makes every day new index for all incoming data (from many hosts) with name like "filebeat-2018.10.25"

Config is:

```
input {
      beats {
        port => 5044
      }
}

filter {
  date {
    match => ["logdate", "ISO8601"]
  }
}

output {
      elasticsearch {
        hosts => ["localhost:9200"]
        sniffing => true
        manage_template => false
        index => "%{[@metadata][beat]}-%{+YYYY.MM.dd}"
        document_type => "log"
      }
}

```

Tell me please what should I change in config to make Logstash create Index for every hostname every day (something like "my-server1-2018.10.24", "my-server2-2018.10.24)?

---

<div class="post-metadata">

**Author:** ![Christian\_Dahlqvist](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/christian_dahlqvist/32/4617_2.png) [@Christian\_Dahlqvist](https://discuss.elastic.co/u/Christian_Dahlqvist)\
**Post date:** [October 25, 2018, 11:34am UTC](https://discuss.elastic.co/t/how-can-i-create-index-per-hostname-per-day/153992/2 "2018-10-25T11:34:33Z")

</div>

Why would you want to do that? Having lots of small indices and shards in the cluster [can be very inefficient](https://www.elastic.co/blog/how-many-shards-should-i-have-in-my-elasticsearch-cluster) as each shard has a certain amount of overhead.

---

<div class="post-metadata">

**Author:** ![09958a6c84c61fe52414](https://avatars.discourse-cdn.com/v4/letter/0/cdc98d/32.png) [@09958a6c84c61fe52414](https://discuss.elastic.co/u/09958a6c84c61fe52414)\
**Post date:** [October 25, 2018, 11:39am UTC](https://discuss.elastic.co/t/how-can-i-create-index-per-hostname-per-day/153992/3 "2018-10-25T11:39:50Z")

</div>

Well, in this case I want to try to have single index per host. I have about 10 servers to monitor, so I'l have persistent number of 10 indexes instead of rising number of indexes every day. Can you please tell me how can I tune my config to do it?

---

<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:** [November 22, 2018, 11:39am UTC](https://discuss.elastic.co/t/how-can-i-create-index-per-hostname-per-day/153992/4 "2018-11-22T11:39:52Z")

</div>

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