# Generate multiple index for diff service logs coming from one single server

**URL:** <https://discuss.elastic.co/t/generate-multiple-index-for-diff-service-logs-coming-from-one-single-server/182361>\
**Category:** Logstash\
**Created:** [May 23, 2019, 7:07am UTC](https://discuss.elastic.co/t/generate-multiple-index-for-diff-service-logs-coming-from-one-single-server/182361 "2019-05-23T07:07:44Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Eva](https://avatars.discourse-cdn.com/v4/letter/e/dbc845/32.png) [@Eva](https://discuss.elastic.co/u/Eva)\
**Post date:** [May 23, 2019, 7:07am UTC](https://discuss.elastic.co/t/generate-multiple-index-for-diff-service-logs-coming-from-one-single-server/182361/1 "2019-05-23T07:07:44Z")

</div>

Hello there  
I would like to know if it is possible to generate more than one "logstash" index for different service logs coming from different services within same server. This is because I have multiple services running on single server and I would want to retain logs only for some services "indefinitely" while logs from some other services can be deleted after certain period of time. I came across Curator which provides the option of deleting logstash indices based on index age and name.  
Now, if all the logs from different service within a server is streamed to elasticsearch as one single index (see below) it may not be possible for me to retain only some logs and delete others because I will have to run curator on entire index which is in the format, say -

output {  
elasticsearch {  
hosts =\> "localhost:9200"  
**index =\> "logstash-%{+YYYY.MM.dd}**"  
}  
}

Let me know if it can be achieved.  
Thanks!

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [May 23, 2019, 1:04pm UTC](https://discuss.elastic.co/t/generate-multiple-index-for-diff-service-logs-coming-from-one-single-server/182361/2 "2019-05-23T13:04:02Z")

</div>

You could either use a [conditional](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html) to switch between outputs, or else use a sprintf reference to a field that identifies the service in order to have service-specific index names.

---

<div class="post-metadata">

**Author:** ![Eva](https://avatars.discourse-cdn.com/v4/letter/e/dbc845/32.png) [@Eva](https://discuss.elastic.co/u/Eva)\
**Post date:** [May 24, 2019, 4:16am UTC](https://discuss.elastic.co/t/generate-multiple-index-for-diff-service-logs-coming-from-one-single-server/182361/3 "2019-05-24T04:16:49Z")

</div>

Thank you!

---

<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:** [June 21, 2019, 4:16am UTC](https://discuss.elastic.co/t/generate-multiple-index-for-diff-service-logs-coming-from-one-single-server/182361/4 "2019-06-21T04:16:52Z")

</div>

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