# Using the date plugin to replace the value of @timestamp

**URL:** https://discuss.elastic.co/t/using-the-date-plugin-to-replace-the-value-of-timestamp/249094
**Category:** Logstash
**Created:** [September 18, 2020, 12:25pm UTC](https://discuss.elastic.co/t/using-the-date-plugin-to-replace-the-value-of-timestamp/249094 "2020-09-18T12:25:06Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![goncalobsantos](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/goncalobsantos/32/50118_2.png) [@goncalobsantos](https://discuss.elastic.co/u/goncalobsantos)
#### Post date: [September 18, 2020, 12:25pm UTC](https://discuss.elastic.co/t/using-the-date-plugin-to-replace-the-value-of-timestamp/249094/1 "2020-09-18T12:25:06Z")

</div>

I am trying to write a .conf file to automatically build monthly indexes.

I've read that Logstash uses @timestamp to identify the month of a document and that this field is in UTC by default.

1. I'm in a timezone different from UTC and
2. I want to use a different time field "mytime" to identify the month of a document.

I'm trying to use the date plugin to replace the value of @timestamp with the value of "mytime".

```
filter {date {
    match => ["mytime" , "ISO8601"]
    timezone => "Europe/Madrid"
    target => "@timestamp"}}output {
elasticsearch {
    index => "myindex-%{+YYYY.MM}"
}}

```

However, this produces the following error:  
[INFO] 2020-09-18 14:17:23.321 [Agent thread] agent - Pipelines running {:count=\>1, :running\_pipelines=\>[:main], :non\_running\_pipelines=\>}  
[INFO] 2020-09-18 14:17:23.457 [Api Webserver] agent - Successfully started Logstash API endpoint {:port=\>9600}  
[ERROR] 2020-09-18 14:17:27.478 [[main]\>worker3] ruby - Ruby exception occurred: can't convert String into an exact number

Any suggestions?  
Thans in advance

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [September 18, 2020, 7:36pm UTC](https://discuss.elastic.co/t/using-the-date-plugin-to-replace-the-value-of-timestamp/249094/2 "2020-09-18T19:36:04Z")

</div>

What does the time in `mytime` looks like?

Also, can you share the full pipeline to show what is your inputs and if you have another filters?

I see nothing in the snippet that you shared that could lead to this error, need to see what logstash is doing, what is the input and how you are parsing the messages.

---

<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 16, 2020, 7:36pm UTC](https://discuss.elastic.co/t/using-the-date-plugin-to-replace-the-value-of-timestamp/249094/3 "2020-10-16T19:36:17Z")

</div>

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