# Date parsing error

**URL:** https://discuss.elastic.co/t/date-parsing-error/95493
**Category:** Elasticsearch
**Created:** [August 2, 2017, 9:21am UTC](https://discuss.elastic.co/t/date-parsing-error/95493 "2017-08-02T09:21:36Z")
**Posts on this page:** 12
**Page:** 1

<div class="post-metadata">

### Author: ![asgoh05](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asgoh05](https://discuss.elastic.co/u/asgoh05)
#### Post date: [August 2, 2017, 9:21am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/1 "2017-08-02T09:21:37Z")

</div>

Hello, I'm beginner of ELK.  
I got a problem while mapping date of my log file.  
Does anybody know how to map this kind of date format ? (20170802-022130.497289)

My mapping source --\>

"column1": {  
"type": "date",  
"format" : "yyyyMMdd-HHmmss.SSSSSS"  
},

mapper\_parsing\_exception --\>

"reason"=\>"failed to parse [column1]", "caused\_by"=\>{"type"=\>"illegal\_argument\_exception", "reason"=\>"Invalid format: "20170802-022130.497289" is malformed at "289""}}}}}

---

<div class="post-metadata">

### Author: ![Ravi\_Shanker\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Ravi\_Shanker\_Reddy](https://discuss.elastic.co/u/Ravi_Shanker_Reddy)
#### Post date: [August 2, 2017, 9:50am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/2 "2017-08-02T09:50:34Z")

</div>

I am using 5.1.1. For me its working fine. FYI adding all the mappings

```
PUT test-date
{
  "mappings": {
    "logs":{
      "properties": {
        "column1":{
          "type": "date",
          "format": "yyyyMMdd-HHmmss.SSSSSS"
        }
      }
    }
  }
}

```

Inserted one document

```
POST test-date/logs/1
{
  "column1": "20170802-022130.497289"
}

```

Search using range query

```
GET test-date/_search
{
  "query": {
    "range": {
      "column1": {
        "format": "yyyy-MM-dd", 
        "gte": "2017-08-01",
        "lte": "2017-08-03"
      }
    }
  }
}
```

---

<div class="post-metadata">

### Author: ![asgoh05](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asgoh05](https://discuss.elastic.co/u/asgoh05)
#### Post date: [August 3, 2017, 12:29am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/3 "2017-08-03T00:29:47Z")

</div>

Oh! Thanks 🙂  
I think "logs" parameter was missed.  
It's working well now!

---

<div class="post-metadata">

### Author: ![asgoh05](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asgoh05](https://discuss.elastic.co/u/asgoh05)
#### Post date: [August 3, 2017, 4:50am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/4 "2017-08-03T04:50:18Z")

</div>

Thanks, but I got one more problem.  
This is what I saw in Kibana.

 ![test](https://us1.discourse-cdn.com/elastic/original/3X/3/4/347ac930c38793c3f5957a2e03570afeec27ea3c.JPG)

when I do mapping with this format, time(hh) value has been changed.

Why does it happen?

Original Value : 20170803-050214.627322  
Mapping Value : 20170803-140214.627

---

<div class="post-metadata">

### Author: ![Ravi\_Shanker\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Ravi\_Shanker\_Reddy](https://discuss.elastic.co/u/Ravi_Shanker_Reddy)
#### Post date: [August 3, 2017, 4:52am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/5 "2017-08-03T04:52:43Z")

</div>

ES always stores the date in GMT format.

---

<div class="post-metadata">

### Author: ![asgoh05](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asgoh05](https://discuss.elastic.co/u/asgoh05)
#### Post date: [August 3, 2017, 4:57am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/6 "2017-08-03T04:57:55Z")

</div>

Yes, I can understand that GMT format was used.  
But I cannot understand why hour is changed **from 05 to 14**

Original Value : 20170803- **05** 0214.627322  
Mapping Value : 20170803- **14** 0214.627

---

<div class="post-metadata">

### Author: ![Ravi\_Shanker\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Ravi\_Shanker\_Reddy](https://discuss.elastic.co/u/Ravi_Shanker_Reddy)
#### Post date: [August 3, 2017, 4:58am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/7 "2017-08-03T04:58:48Z")

</div>

In what time zone you written your log???

---

<div class="post-metadata">

### Author: ![asgoh05](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asgoh05](https://discuss.elastic.co/u/asgoh05)
#### Post date: [August 3, 2017, 5:08am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/8 "2017-08-03T05:08:39Z")

</div>

Thanks for your really fast support!

Oh! now I understand what you mean.  
I was using (UTC+01:00) Amsterdam for log file, and (UTC+09:00) Seoul for ELK Server.

There are 8h of time difference . Not exactly matching with time difference but anyway, Is there any method to ignore time zone then?

---

<div class="post-metadata">

### Author: ![Ravi\_Shanker\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Ravi\_Shanker\_Reddy](https://discuss.elastic.co/u/Ravi_Shanker_Reddy)
#### Post date: [August 3, 2017, 5:12am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/9 "2017-08-03T05:12:28Z")

</div>

Try this mapping

```
PUT test-date
{
  "mappings": {
    "logs":{
      "properties": {
        "column1":{
          "type": "date",
          "format": "yyyyMMdd-HHmmss.SSSSSS Z"
        }
      }
    }
  }
}

```

And index the data with time zones

```
POST test-date/logs/1
{
  "column1": "20170802-022130.497289 +0100"
}
```

---

<div class="post-metadata">

### Author: ![Ravi\_Shanker\_Reddy](https://avatars.discourse-cdn.com/v4/letter/r/a5b964/32.png) [@Ravi\_Shanker\_Reddy](https://discuss.elastic.co/u/Ravi_Shanker_Reddy)
#### Post date: [August 3, 2017, 5:16am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/10 "2017-08-03T05:16:04Z")

</div>

> [@asgoh05](#):
>
> I was using (UTC+01:00) Amsterdam for log file, and (UTC+09:00) Seoul for ELK Server.

Sorry what you understand here is wrong.

> [@asgoh05](#):
>
> Original Value : 20170803-050214.627322

If you don't pass time zone ES thinks that you are passing GMT time. Means UTC +00:00. So you have nine hours gap there

---

<div class="post-metadata">

### Author: ![asgoh05](https://avatars.discourse-cdn.com/v4/letter/a/50afbb/32.png) [@asgoh05](https://discuss.elastic.co/u/asgoh05)
#### Post date: [August 3, 2017, 5:31am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/11 "2017-08-03T05:31:15Z")

</div>

Yes, you were right!  
It was not the problem of data.

I corrected time zone of Kibana which was browser default.  
Management -\> Advanced Setting -\> dateFormat:tz to Etc:GMT  
and it displayed perfectly!

Anyway thank you very much Ravi 🙂

Best Regards  
SG

---

<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 31, 2017, 5:31am UTC](https://discuss.elastic.co/t/date-parsing-error/95493/12 "2017-08-31T05:31:33Z")

</div>

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