# Logstash - replace @timestamp

**URL:** <https://discuss.elastic.co/t/logstash-replace-timestamp/261553>\
**Category:** Logstash\
**Created:** [January 19, 2021, 2:01pm UTC](https://discuss.elastic.co/t/logstash-replace-timestamp/261553 "2021-01-19T14:01:23Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![iccMe](https://avatars.discourse-cdn.com/v4/letter/i/ba8739/32.png) [@iccMe](https://discuss.elastic.co/u/iccMe)\
**Post date:** [January 19, 2021, 2:01pm UTC](https://discuss.elastic.co/t/logstash-replace-timestamp/261553/1 "2021-01-19T14:01:23Z")

</div>

Hi,

Looking for help with a date and time filter in logstash. I created a new Time field putting together a previous date and time field that I subsequently drop.

The new Time field looks like the below in my output:  
`"Time":"2021-01-05 00:00:10"`

I have tried the following filters, but still not getting it to replace the @timestamp:

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

```

and

```
	date { 
		match => ["Time", "[YYYY-MM-dd HH:mm:ss]" ]
		target => "@timestamp"
	}

```

neither has worked. Any other suggestion would be great

---

<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:** [January 19, 2021, 2:08pm UTC](https://discuss.elastic.co/t/logstash-replace-timestamp/261553/2 "2021-01-19T14:08:57Z")

</div>

There is no `[` and `]` around the time format.

You should use

```auto
date { 
    match => ["Time", "yyyy-MM-dd HH:mm:ss"]
}

```

You also don't need the `target` option if your target is the `@timestamp` field.

---

<div class="post-metadata">

**Author:** ![iccMe](https://avatars.discourse-cdn.com/v4/letter/i/ba8739/32.png) [@iccMe](https://discuss.elastic.co/u/iccMe)\
**Post date:** [January 19, 2021, 2:16pm UTC](https://discuss.elastic.co/t/logstash-replace-timestamp/261553/3 "2021-01-19T14:16:49Z")

</div>

Tremendous, couldn't see what was right in front of my eyes!!

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:** [February 16, 2021, 2:16pm UTC](https://discuss.elastic.co/t/logstash-replace-timestamp/261553/4 "2021-02-16T14:16:50Z")

</div>

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