# Logstash Date parsing error from Kinesis

**URL:** <https://discuss.elastic.co/t/logstash-date-parsing-error-from-kinesis/215310>\
**Category:** Logstash\
**Created:** [January 16, 2020, 12:20pm UTC](https://discuss.elastic.co/t/logstash-date-parsing-error-from-kinesis/215310 "2020-01-16T12:20:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris\_Broll](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@Chris\_Broll](https://discuss.elastic.co/u/Chris_Broll)\
**Post date:** [January 16, 2020, 12:20pm UTC](https://discuss.elastic.co/t/logstash-date-parsing-error-from-kinesis/215310/1 "2020-01-16T12:20:35Z")

</div>

I have picked up a Logstash server to look after and I can see some incoming events from a Kinesis input that is failing to be indexed:

```
 Could not index event to Elasticsearch. {:status=>400, :action=>["index", {:_id=>nil, :_index=>"fargate-container-development-2020.01.16", :_type=>"doc", :_routing=>nil}, #<LogStash::Event:0x7677b8d7>], :response=>{"index"=>{"_index"=>"fargate-container-development-2020.01.16", "_type"=>"doc", "_id"=>"1234567890", "status"=>400, "error"=>{"type"=>"mapper_parsing_exception", "reason"=>"failed to parse [time]", "caused_by"=>{"type"=>"illegal_argument_exception", "reason"=>"For input string: \"2020-01-16T11:29:38.157Z\""}}}}}

```

I thought that should be a simple fix and tried this:

```
filter {
  if "kinesis" in [tags] and "fargatecontainerlogs" in [tags] {
    date {
      match => ["time", "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'", "ISO8601"]
      target => "@timestamp"
      remove_field => ["time"]
    }

    json {
      source => "message"
      remove_field => ["message"]
    }
  }
}

```

Any idea where I went wrong?

---

<div class="post-metadata">

**Author:** ![Chris\_Broll](https://avatars.discourse-cdn.com/v4/letter/c/58956e/32.png) [@Chris\_Broll](https://discuss.elastic.co/u/Chris_Broll)\
**Post date:** [January 17, 2020, 3:22pm UTC](https://discuss.elastic.co/t/logstash-date-parsing-error-from-kinesis/215310/2 "2020-01-17T15:22:01Z")

</div>

So I tried changing the order of the json parse and the date parse and it started working.

---

<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 14, 2020, 3:22pm UTC](https://discuss.elastic.co/t/logstash-date-parsing-error-from-kinesis/215310/3 "2020-02-14T15:22:07Z")

</div>

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