# Logstash index format interpreted literally

**URL:** https://discuss.elastic.co/t/logstash-index-format-interpreted-literally/250461
**Category:** Logstash
**Created:** [September 30, 2020, 7:48am UTC](https://discuss.elastic.co/t/logstash-index-format-interpreted-literally/250461 "2020-09-30T07:48:43Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![vinci](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vinci](https://discuss.elastic.co/u/vinci)
#### Post date: [September 30, 2020, 7:48am UTC](https://discuss.elastic.co/t/logstash-index-format-interpreted-literally/250461/1 "2020-09-30T07:48:43Z")

</div>

Hello,

I've created several indices with logstash using the following settings:

```auto
output
{
        stdout {
                codec => dots
        }

        elasticsearch {
                hosts => ["http://192.168.99.18:9200"]
                index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
                user => "elastic"
                password => "password"
        }
}

```

The problem is that I ended up literally with this format in elasticsearch:

```auto
%{[@metadata][beat]}-%{[@metadata][version]}-2014.06.26
%{[@metadata][beat]}-%{[@metadata][version]}-2014.06.03
%{[@metadata][beat]}-%{[@metadata][version]}-2014.06.25
etc.

```

Does anyone know where the problem lies and how I can make logstash interpret the variables correctly?

Thanks.

---

<div class="post-metadata">

### Author: ![kavierkoo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kavierkoo/32/86555_2.png) [@kavierkoo](https://discuss.elastic.co/u/kavierkoo)
#### Post date: [September 30, 2020, 12:01pm UTC](https://discuss.elastic.co/t/logstash-index-format-interpreted-literally/250461/2 "2020-09-30T12:01:56Z")

</div>

Hi, What is your logstash version?  
For debugging, I would try to add below to output to see what are the fields available.

```auto
  stdout {
    codec => rubydebug { metadata => true }
  }

```

---

<div class="post-metadata">

### Author: ![vinci](https://avatars.discourse-cdn.com/v4/letter/v/b5e925/32.png) [@vinci](https://discuss.elastic.co/u/vinci)
#### Post date: [September 30, 2020, 12:20pm UTC](https://discuss.elastic.co/t/logstash-index-format-interpreted-literally/250461/3 "2020-09-30T12:20:27Z")

</div>

Version 7.7.1 So is elastisearch also.  
The debug output I'm supposed to see directly in the logstash logs under /var/log, right? (logstash is installed directly on the host).

---

<div class="post-metadata">

### Author: ![kavierkoo](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/kavierkoo/32/86555_2.png) [@kavierkoo](https://discuss.elastic.co/u/kavierkoo)
#### Post date: [September 30, 2020, 12:41pm UTC](https://discuss.elastic.co/t/logstash-index-format-interpreted-literally/250461/4 "2020-09-30T12:41:02Z")

</div>

` codec => rubydebug` will only print on screen.

If you want it to store in files, you will have to use file plugin

```auto
output {
 file {
   path => /tmp/my_output_text_file
   codec => rubydebug { metadata => true }
 }
}

```

Referring Link from:

> [@Where can I find rubydebug output](https://discuss.elastic.co/t/where-can-i-find-rubydebug-output/94905/2):
>
> Your description is a bit basic, so I'm not sure if this is your config. Assuming you have a valid input and filter config part, your output should look something like this: output { stdout { codec =\> rubydebug } } The above example will give you a ruby debug output on your console. If you would rather write it to file you can do it like this: output { file { path =\> /tmp/my\_output\_text\_file codec =\> rubydebug } }

---

<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: [October 28, 2020, 12:41pm UTC](https://discuss.elastic.co/t/logstash-index-format-interpreted-literally/250461/5 "2020-10-28T12:41:03Z")

</div>

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