# Separate production logs - logstash

**URL:** <https://discuss.elastic.co/t/separate-production-logs-logstash/173178>\
**Category:** Logstash\
**Created:** [March 20, 2019, 3:04pm UTC](https://discuss.elastic.co/t/separate-production-logs-logstash/173178 "2019-03-20T15:04:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Habbiot](https://avatars.discourse-cdn.com/v4/letter/h/13edae/32.png) [@Habbiot](https://discuss.elastic.co/u/Habbiot)\
**Post date:** [March 20, 2019, 3:04pm UTC](https://discuss.elastic.co/t/separate-production-logs-logstash/173178/1 "2019-03-20T15:04:29Z")

</div>

This is a to continue [[Separate production logs](https://discuss.elastic.co/t/separate-production-logs/173146/2)].

I have an single ELK stack collecting both Production and Development logs. Logstash is parses logs to elasticsearch.

1. How can I use the same cluster to separate production from development logs ?
2. what is the recommended approach to collect logs use ELK stack when more then two environments are present eg, test, dev, stage etc..

---

<div class="post-metadata">

**Author:** ![kharvey](https://avatars.discourse-cdn.com/v4/letter/k/d07c76/32.png) [@kharvey](https://discuss.elastic.co/u/kharvey)\
**Post date:** [March 20, 2019, 3:42pm UTC](https://discuss.elastic.co/t/separate-production-logs-logstash/173178/2 "2019-03-20T15:42:49Z")

</div>

You can just setup different indexes for your production and development logs in the Output of your pipeline.

```auto
output {
	if "realtime-log" == [type] {
		elasticsearch {
			ssl => true
			cacert => "/etc/logstash/.crt"
			hosts => ["https://elasticsearch:9200"]
			codec => "json"
			action => "index"
			index => "%{indexname}-%{+YYYY.MM.dd}"
			id => "realtime-log-out"
		}
	}
}
```

In this case, I am setting an indexname and appending the current date to my index before I submit it to Elastic Search.

---

<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:** [April 17, 2019, 3:42pm UTC](https://discuss.elastic.co/t/separate-production-logs-logstash/173178/3 "2019-04-17T15:42:50Z")

</div>

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