# Why does the replacement @timestamp fail？

**URL:** <https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210>\
**Category:** Logstash\
**Created:** [September 19, 2020, 8:58am UTC](https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210 "2020-09-19T08:58:09Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [September 19, 2020, 8:58am UTC](https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210/1 "2020-09-19T08:58:09Z")

</div>

The index pattern was created without any timestamp.

 ![image](https://us1.discourse-cdn.com/elastic/original/3X/7/2/729917349c09840bbd7645dfab8e6e11613f33be.png)

> ```
> filter {
> date {
> match => ["[CreationTime]","yyyy-MM-dd HH:mm:ss.SSS"]
> timezone => "Asia/Shanghai"
> target => "@timestamp"
> }
> }
> mutate {
> replace => ["@timestamp", "%{CreationTime}"]
> }
> 
> ```

The result is not right.  
 ![image](https://us1.discourse-cdn.com/elastic/original/3X/5/e/5eb921e22b72f32957488c46d06c4bb633f5e2df.png)

---

<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:** [September 19, 2020, 8:33pm UTC](https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210/2 "2020-09-19T20:33:27Z")

</div>

> [@wajika](#):
>
> `"yyyy-MM-dd HH:mm:ss.SSS"`

Looks to me like there are two spaces. Try

```
"yyyy-MM-dd HH:mm:ss.SSS"

```

---

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [September 21, 2020, 5:13am UTC](https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210/3 "2020-09-21T05:13:55Z")

</div>

Even if I use "yyyy-MM-dd HH:mm:ss.SSS", it still fails.  
@Badger

---

<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:** [September 21, 2020, 2:02pm UTC](https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210/4 "2020-09-21T14:02:07Z")

</div>

Your [CreationTime] field does not have a sub-second part. The date filter pattern must exactly match the field. Try

```
"yyyy-MM-dd HH:mm:ss"
```

---

<div class="post-metadata">

**Author:** ![wajika](https://avatars.discourse-cdn.com/v4/letter/w/977dab/32.png) [@wajika](https://discuss.elastic.co/u/wajika)\
**Post date:** [September 22, 2020, 2:14am UTC](https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210/5 "2020-09-22T02:14:32Z")

</div>

I have tested it before and it was not successful.

> date {  
> match =\> ["[CreationTime]","yyyy-MM-dd HH:mm:ss","ISO8601"]  
> timezone =\> "Asia/Shanghai"  
> target =\> "@timestamp"  
> }

Is there any way to debug the date plugin?

---

<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 22, 2020, 1:09pm UTC](https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210/6 "2020-09-22T13:09:15Z")

</div>

Try

```auto
    date {
        match => ["yyyy-MM-dd HH:mm:ss","yyyy-MM-dd HH:mm:ss","ISO8601"]
        timezone => "Asia/Shanghai"
        target => "@timestamp"
    }

```

---

<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 20, 2020, 1:09pm UTC](https://discuss.elastic.co/t/why-does-the-replacement-timestamp-fail/249210/7 "2020-10-20T13:09:27Z")

</div>

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