# Help: Only winlogbeat index with date being created

**URL:** <https://discuss.elastic.co/t/help-only-winlogbeat-index-with-date-being-created/300284>\
**Category:** Elasticsearch\
**Created:** [March 22, 2022, 7:43am UTC](https://discuss.elastic.co/t/help-only-winlogbeat-index-with-date-being-created/300284 "2022-03-22T07:43:19Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![roman-tasi](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@roman-tasi](https://discuss.elastic.co/u/roman-tasi)\
**Post date:** [March 22, 2022, 7:43am UTC](https://discuss.elastic.co/t/help-only-winlogbeat-index-with-date-being-created/300284/1 "2022-03-22T07:43:19Z")

</div>

This is my current output:

```auto
output {

        if [type]=="syslog" {
                elasticsearch {
                hosts => ["localhost:9200"]
                index => "logstash-%{+yyyy.MM.dd}"
                }
        stdout { codec => rubydebug }
        file { path => "/etc/logstash/logstash-data/%{logstash}.%{+YYYY.MM.dd}" }
        }

        if [type]=="winlogbeat" {
                elasticsearch {
                hosts => ["localhost:9200"]
                index => "winlogbeat-%{+yyyy.MM.dd}"
                }
        stdout { codec => rubydebug }
        file { path => "/etc/logstash/logstash-data/%{winlogbeat}.%{+YYYY.MM.dd}" }
        }
}

```

However I am creating a `winlogbeat-2022.03.21` index and a `logstash` index. In other words, only the winlogbeat index has the date. Can anyone tell me why or show me how to fix this?

Also this is my current `date` field in my `filter`:

```auto
date {
            match => ["[sslvpn][time]", "yyyy-MM-dd HH:mm:ss" ]
            target => "@timestamp"
    }

```

But unsure what else to add. I understand that winlogbeat might have the built-in `yyyy.MM.dd` format, but SSLVPN/Logstash may need to be filtered/created on its own.

---

<div class="post-metadata">

**Author:** ![FALEN](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/falen/32/82754_2.png) [@FALEN](https://discuss.elastic.co/u/FALEN)\
**Post date:** [March 22, 2022, 8:15am UTC](https://discuss.elastic.co/t/help-only-winlogbeat-index-with-date-being-created/300284/2 "2022-03-22T08:15:33Z")

</div>

Shouldnt your second "if" needs to be "else if" ?

---

<div class="post-metadata">

**Author:** ![roman-tasi](https://avatars.discourse-cdn.com/v4/letter/r/7ea924/32.png) [@roman-tasi](https://discuss.elastic.co/u/roman-tasi)\
**Post date:** [March 22, 2022, 8:17am UTC](https://discuss.elastic.co/t/help-only-winlogbeat-index-with-date-being-created/300284/3 "2022-03-22T08:17:26Z")

</div>

Not 100% sure but my winlogbeat seems to be working as intended just with the "if".

---

<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 19, 2022, 8:17am UTC](https://discuss.elastic.co/t/help-only-winlogbeat-index-with-date-being-created/300284/4 "2022-04-19T08:17:51Z")

</div>

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