# +FORMAT syntax works for @timestamp field only?

**URL:** https://discuss.elastic.co/t/format-syntax-works-for-timestamp-field-only/205037
**Category:** Logstash
**Created:** [October 24, 2019, 9:53am UTC](https://discuss.elastic.co/t/format-syntax-works-for-timestamp-field-only/205037 "2019-10-24T09:53:55Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)
#### Post date: [October 24, 2019, 9:53am UTC](https://discuss.elastic.co/t/format-syntax-works-for-timestamp-field-only/205037/1 "2019-10-24T09:53:55Z")

</div>

can some other timestamp field be used with `+FORMAT` syntax?

```auto
index => "${ELASTICSEARCH_INDEX}.%{+yyyy.MM.dd}"

```

the above config line would use `@timestamp` as the input for the format definition, but I'd like to use some other field.  
Thanks!

---

<div class="post-metadata">

### Author: ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)
#### Post date: [October 24, 2019, 12:54pm UTC](https://discuss.elastic.co/t/format-syntax-works-for-timestamp-field-only/205037/2 "2019-10-24T12:54:59Z")

</div>

since I don't need the default `@timestamp` field in the index, but would like to use the `+FORMAT` syntax for the index naming, I have to use the following workaround (my "local" timestamp field is `server_time` in ISO8601 format):

```auto
mutate {
        copy => { "server_time" => "@timestamp" }
        add_field => { "[@metadata][date]" => "%{+yyyy.MM.dd}" }
        remove_field => ["@version", "@timestamp", "host", ...]
}

```

and in the ES output:

```auto
index => "${ELASTICSEARCH_INDEX}-%{[@metadata][date]}"

```

would be glad if someone could share a more elegant solution.

---

<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: [October 24, 2019, 1:00pm UTC](https://discuss.elastic.co/t/format-syntax-works-for-timestamp-field-only/205037/3 "2019-10-24T13:00:26Z")

</div>

> [@jetnet](#):
>
> can some other timestamp field be used with `+FORMAT` syntax?

No, it always uses @timestamp.

---

<div class="post-metadata">

### Author: ![jetnet](https://avatars.discourse-cdn.com/v4/letter/j/a87d85/32.png) [@jetnet](https://discuss.elastic.co/u/jetnet)
#### Post date: [October 24, 2019, 2:06pm UTC](https://discuss.elastic.co/t/format-syntax-works-for-timestamp-field-only/205037/4 "2019-10-24T14:06:17Z")

</div>

thanks for confirming that!  
I'm asking myself: why didn't they mention this point in the [documentation](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#sprintf)? Just one small sentence would save a lot of time...

---

<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 21, 2019, 2:06pm UTC](https://discuss.elastic.co/t/format-syntax-works-for-timestamp-field-only/205037/5 "2019-11-21T14:06:17Z")

</div>

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