# Date parsing issue

**URL:** <https://discuss.elastic.co/t/date-parsing-issue/319246>\
**Category:** Logstash\
**Created:** [November 17, 2022, 10:14pm UTC](https://discuss.elastic.co/t/date-parsing-issue/319246 "2022-11-17T22:14:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![rajsolanki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajsolanki/32/86859_2.png) [@rajsolanki](https://discuss.elastic.co/u/rajsolanki)\
**Post date:** [November 17, 2022, 10:14pm UTC](https://discuss.elastic.co/t/date-parsing-issue/319246/1 "2022-11-17T22:14:22Z")

</div>

I m having strange issue with Date parsing. Here is my config.

```auto
input { stdin { } }
output { stdout { codec => rubydebug } }
filter {
  date {
    match => ["message", "ISO8601"]
  }
}

```

when i run echo '2022-11-17 15:30:32.000' | /bin/logstash -f date.config output is

"@timestamp" =\> **2022-11-17T21:30:32Z** ,  
"event" =\> {  
"original" =\> "2022-11-17 15:30:32.000"  
}

You can see @timestamp is removing 000

when i run echo '2022-11-17 15:30:32.001' | /bin/logstash -f date.config output is

"@timestamp" =\> **2022-11-17T21:30:32.001Z,**  
"event" =\> {  
"original" =\> "2022-11-17 15:30:32.001"  
},

So any way to force logstash to assign @timestamp including 000 ?

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [November 17, 2022, 10:24pm UTC](https://discuss.elastic.co/t/date-parsing-issue/319246/2 "2022-11-17T22:24:36Z")

</div>

```auto
filter {
  date {
    match => ["message", "YYYY-MM-dd HH:mm:ss.SSS"]
	target => "time"
  }
}

```

```auto
{
    "@timestamp" => 2022-11-17T21:23:09.258725600Z,
          "time" => 2022-11-17T14:30:32.000Z,
       "message" => "2022-11-17 15:30:32.000"
}

```

---

<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:** [November 17, 2022, 10:28pm UTC](https://discuss.elastic.co/t/date-parsing-issue/319246/3 "2022-11-17T22:28:20Z")

</div>

Why does it matter? Do you have a downstream system that consumes rubydebug output? The underlying Timestamp objects both have the same precision.

[This PR](https://github.com/elastic/logstash/pull/14299) suggests that Timestamp#to\_string in logstash 7.x always had 3 digits of sub-second precision, and once Elastic ship a release containing that PR then logstash 8 will too.

---

<div class="post-metadata">

**Author:** ![rajsolanki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajsolanki/32/86859_2.png) [@rajsolanki](https://discuss.elastic.co/u/rajsolanki)\
**Post date:** [November 18, 2022, 12:40am UTC](https://discuss.elastic.co/t/date-parsing-issue/319246/4 "2022-11-18T00:40:14Z")

</div>

yes downstream system consumes that plus i have a pipe line which converts @timestamp value to localtime (CST) which is used in an alert email generated by watcher.

```auto
if(ctx.containsKey("@timestamp")) { 
            
            def sf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
            def dt1 = String.valueOf(ctx['@timestamp']);
            def dt = sf.parse(dt1);
            def calendar = sf.getCalendar();
            calendar.setTime(dt);
            def instant = calendar.toInstant();
            def localDateTime = LocalDateTime.ofInstant(instant, ZoneOffset.UTC);
            def localtime = localDateTime.minusHours(12);
            
            ctx.localtime = localtime.toString() + ' CST';

          }
        

```

---

<div class="post-metadata">

**Author:** ![rajsolanki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rajsolanki/32/86859_2.png) [@rajsolanki](https://discuss.elastic.co/u/rajsolanki)\
**Post date:** [November 18, 2022, 4:07am UTC](https://discuss.elastic.co/t/date-parsing-issue/319246/5 "2022-11-18T04:07:49Z")

</div>

> [@Badger](#):
>
> [This PR](https://github.com/elastic/logstash/pull/14299) suggests that Timestamp#to\_string in logstash 7.x always had 3 digits of sub-second precision, and once Elastic ship a release containing that PR then logstash 8 will too.

So one of the label on link has 8.4 . does it mean its released as part of 8.4+ ?

---

<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:** [November 18, 2022, 4:27am UTC](https://discuss.elastic.co/t/date-parsing-issue/319246/6 "2022-11-18T04:27:36Z")

</div>

Yes, it is labelled as 8.4.0 and it gets [mentioned](https://www.elastic.co/guide/en/logstash/current/logstash-8-4-0.html#notable-8.4.0) as the third entry in the _Notable issues fixed_ section of the 8.4.0 release notes.

---

<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:** [December 16, 2022, 4:28am UTC](https://discuss.elastic.co/t/date-parsing-issue/319246/7 "2022-12-16T04:28:30Z")

</div>

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