# Date processor error

**URL:** <https://discuss.elastic.co/t/date-processor-error/279173>\
**Category:** Elasticsearch\
**Tags:** ingest-pipeline\
**Created:** [July 20, 2021, 1:49pm UTC](https://discuss.elastic.co/t/date-processor-error/279173 "2021-07-20T13:49:06Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![omurad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/omurad/32/91292_2.png) [@omurad](https://discuss.elastic.co/u/omurad)\
**Post date:** [July 20, 2021, 1:49pm UTC](https://discuss.elastic.co/t/date-processor-error/279173/1 "2021-07-20T13:49:06Z")

</div>

I'm looking to parse the following date using the "Date" ingest processor

`20/Jul/2021:07:28:46 --0400`

I tried doing so using these formats

`dd/MMM/yyyy:HH:mm:ss -ZZZZZ`  
`dd/MMM/yyyy:HH:mm:ss '-'ZZZZZ`

However, I get the following error:

```auto
Text '20/Jul/2021:07:28:46 --0400' could not be parsed at index 22

```

What format can I use to parse the date/time string?

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 20, 2021, 6:52pm UTC](https://discuss.elastic.co/t/date-processor-error/279173/2 "2021-07-20T18:52:45Z")

</div>

Try This... BTW that is a poor / atypical time format in the string with the extra `-`

```auto
POST /_ingest/pipeline/_simulate
{
  "pipeline": {
    "description": "time test",
    "version": 0,
    "processors": [
      {
        "date": {
          "field": "mydate",
          "formats": ["dd/MMM/yyyy:HH:mm:ss -Z"]
        }
      }
    ]
  },
  "docs": [
    {
      "_index": "m-index",
      "_id": "kMpUTHoBr7SFhhL5-98P",
      "_source": {
        "mydate": "20/Jul/2021:07:28:46 --0400"
    }
    }
  ]
}

```

result

```auto
{
  "docs" : [
    {
      "doc" : {
        "_index" : "m-index",
        "_type" : "_doc",
        "_id" : "kMpUTHoBr7SFhhL5-98P",
        "_source" : {
          "mydate" : "20/Jul/2021:07:28:46 --0400",
          "@timestamp" : "2021-07-20T11:28:46.000Z"
        },
        "_ingest" : {
          "timestamp" : "2021-07-20T18:52:20.77606153Z"
        }
      }
    }
  ]
}

```

---

<div class="post-metadata">

**Author:** ![omurad](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/omurad/32/91292_2.png) [@omurad](https://discuss.elastic.co/u/omurad)\
**Post date:** [July 20, 2021, 7:09pm UTC](https://discuss.elastic.co/t/date-processor-error/279173/3 "2021-07-20T19:09:38Z")

</div>

Thank you!

Unfortunately the extra `-` is there by default in ModSecurity logs 😕

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [July 20, 2021, 9:36pm UTC](https://discuss.elastic.co/t/date-processor-error/279173/4 "2021-07-20T21:36:04Z")

</div>

@omurad  
Thanks! I did not know that about the mod sec logs.

---

<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:** [August 17, 2021, 9:37pm UTC](https://discuss.elastic.co/t/date-processor-error/279173/5 "2021-08-17T21:37:01Z")

</div>

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