# DateFormat in ingest pipeline

**URL:** https://discuss.elastic.co/t/dateformat-in-ingest-pipeline/295567
**Category:** Kibana
**Created:** [January 27, 2022, 10:31am UTC](https://discuss.elastic.co/t/dateformat-in-ingest-pipeline/295567 "2022-01-27T10:31:24Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mukesh\_Rawat](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mukesh_rawat/32/98797_2.png) [@Mukesh\_Rawat](https://discuss.elastic.co/u/Mukesh_Rawat)
#### Post date: [January 27, 2022, 10:31am UTC](https://discuss.elastic.co/t/dateformat-in-ingest-pipeline/295567/1 "2022-01-27T10:31:24Z")

</div>

Hi i have created ingest pipeline to fetch custom logs, my pipeline with processor looks like below

```auto
[
  {
    "grok": {
      "field": "message",
      "patterns": [
        "\\[%{TIMESTAMP_ISO8601:timestamp}\\] %{DATA:env}\\.%{DATA:log.level}: (?<message>(.|\r|\n)*)"
      ],
      "ignore_missing": true
    }
  },
  {
    "date": {
      "field": "timestamp",
      "formats": [
        "yyyy-MM-dd'T'HH:mm:ss.SSXX"
      ],
      "target_field": "@timestamp"
    }
  },
  {
    "json": {
      "field": "message",
      "add_to_root": true,
      "ignore_failure": true
    }
  }
]

```

now when i am sending logs in date format **[2022-01-27T08:31:16.806171+00:00]**

it gives error  
`{"type":"illegal_argument_exception","reason":"failed to parse date field [2022-01-27T10:22:49.234717+00:00] with format [yyyy-MM-dd'T'HH:mm:ss.SSXX]","caused_by":{"type":"date_time_parse_exception","reason":"Text '2022-01-27T10:22:49.234717+00:00' could not be parsed at index 22"}}`

can anyone help what exactly wrong here

---

<div class="post-metadata">

### Author: ![Tomo\_M](https://avatars.discourse-cdn.com/v4/letter/t/848f3c/32.png) [@Tomo\_M](https://discuss.elastic.co/u/Tomo_M)
#### Post date: [January 27, 2022, 11:04am UTC](https://discuss.elastic.co/t/dateformat-in-ingest-pipeline/295567/2 "2022-01-27T11:04:58Z")

</div>

> [@Mukesh\_Rawat](#):
>
> [2022-01-27T08:31:16.806171+00:00]

The format is wrong. The format should be `"yyyy-MM-dd'T'HH:mm:ss.SSSSSSXXX"`.  
See [here](https://www.elastic.co/guide/en/elasticsearch/reference/master/mapping-date-format.html) and [here](https://docs.oracle.com/javase/8/docs/api/java/time/format/DateTimeFormatter.html) carefully.

You can use this value also in `date` field but the microsecond accuracy will be discarded. To hold the accuracy use `date_nanos` field type.

> **Fraction** : Outputs the nano-of-second field as a fraction-of-second. The nano-of-second value has nine digits, thus the count of pattern letters is from 1 to 9. If it is less than 9, then the nano-of-second value is truncated, with only the most significant digits being output.

> **Offset X and x** :Three letters outputs the hour and minute, with a colon, such as '+01:30'.

---

<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 24, 2022, 11:05am UTC](https://discuss.elastic.co/t/dateformat-in-ingest-pipeline/295567/3 "2022-02-24T11:05:55Z")

</div>

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