# Logstash saving to two different indexes at the same time

**URL:** <https://discuss.elastic.co/t/logstash-saving-to-two-different-indexes-at-the-same-time/105666>\
**Category:** Logstash\
**Created:** [October 29, 2017, 3:05pm UTC](https://discuss.elastic.co/t/logstash-saving-to-two-different-indexes-at-the-same-time/105666 "2017-10-29T15:05:10Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rafael\_Carvallo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafael_carvallo/32/23526_2.png) [@Rafael\_Carvallo](https://discuss.elastic.co/u/Rafael_Carvallo)\
**Post date:** [October 29, 2017, 3:05pm UTC](https://discuss.elastic.co/t/logstash-saving-to-two-different-indexes-at-the-same-time/105666/1 "2017-10-29T15:05:10Z")

</div>

Hi,

I'd like to request some help with logstash, currently I'm trying to use it as a rsyslog gatherer, basically I've got this setup:

Devices Reporting to RSYSLOG  
RSYSLOG sending the logs to Logstash as JSON  
Logstash sending the data to ElasticSearch

It's working, but I noticed that by default it saved the data with the following index:

logstash-DATE

Where Date is the current day, I wanted to change this so all the logs from Rsyslog are saved using the index "syslog-infr-DATE" so I basically used this code to achieve it:

```
input {
  udp {
    host => "127.0.0.1"
    port => "10514"
    codec => "json"
    type => "rsyslog"
  }
}

output {
  if [type] == "rsyslog" {
    elasticsearch {
      hosts => ["172.16.0.4:9200"]
      index => "syslog-infr-%{+YYYY.MM.dd}"
    }
  }
}

```

It worked, it's saving it now with the index syslog-infr-DATE, but, at the same time it keeps saving the same records in parallel to the old index. So I basically have the same data in two indexes:

syslog-infr-DATE  
logstash-DATE

I don't know how to avoid this happening, my setup is basically using default values (in Logstash, Kibana and Elasticsearch) except for the IP addresses I changed (where to listen) and that configuration I just showed.

I'm using v5 of the ELK stack.

Thank you for any help in advance.

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [October 29, 2017, 11:36pm UTC](https://discuss.elastic.co/t/logstash-saving-to-two-different-indexes-at-the-same-time/105666/2 "2017-10-29T23:36:04Z")

</div>

Please show your entire config, it will help diagnose the problem.

Also we’ve renamed ELK to the Elastic Stack, otherwise Beats and APM feel left out! 😉

---

<div class="post-metadata">

**Author:** ![Rafael\_Carvallo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rafael_carvallo/32/23526_2.png) [@Rafael\_Carvallo](https://discuss.elastic.co/u/Rafael_Carvallo)\
**Post date:** [October 30, 2017, 9:56pm UTC](https://discuss.elastic.co/t/logstash-saving-to-two-different-indexes-at-the-same-time/105666/3 "2017-10-30T21:56:13Z")

</div>

Hi,

Thank you for the reply. I found out what was happening, I basically left some configuration that I was testing around and didn't notice, my bad.

And I'll sure remember not to call it the "ELK stack" again haha.

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:** [November 27, 2017, 9:56pm UTC](https://discuss.elastic.co/t/logstash-saving-to-two-different-indexes-at-the-same-time/105666/4 "2017-11-27T21:56:33Z")

</div>

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