# Unable to sort logs on the basis of timestamp

**URL:** <https://discuss.elastic.co/t/unable-to-sort-logs-on-the-basis-of-timestamp/131126>\
**Category:** Elasticsearch\
**Created:** [May 9, 2018, 8:22am UTC](https://discuss.elastic.co/t/unable-to-sort-logs-on-the-basis-of-timestamp/131126 "2018-05-09T08:22:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ashish1234](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Ashish1234](https://discuss.elastic.co/u/Ashish1234)\
**Post date:** [May 9, 2018, 8:22am UTC](https://discuss.elastic.co/t/unable-to-sort-logs-on-the-basis-of-timestamp/131126/1 "2018-05-09T08:22:28Z")

</div>

grok filter:

filter {  
grok {  
match =\> { "message" =\> "[%{LOGLEVEL:Severity}]:[%{DATA:User\_Name}]:[%{TIMESTAMP\_ISO8601:event\_time}]:[%{DATA:Session\_ID}]:[%{DATA:Function\_Name}]:[%{DATA:Event}]:[%{DATA:Activity\_Status}]:[%{GREEDYDATA:message}]"  
}

}

date {  
match =\> ["timestamp", "dd/MM/yyyy HH:mm:ss"]  
target =\> "@timestamp"  
}

}

elasticsearch curl request:

curl -XGET "[http://172.25.2.206:9200/elk\_db/\_search?size=1000&pretty](http://172.25.2.206:9200/elk_db/_search?size=1000&pretty)" -H 'Content-Type: application/json' -d'

{

"sort": [  
{ "event\_time": {"order" : "asc"} }  
],

"query": {  
"bool": {  
"must": [  
{ "match": { "Session\_ID": "323232" }}

```
  ]

}

```

}

}'

Mapping:

{"elk\_db":{"mappings":{"doc":{"properties":{"@timestamp":{"type":"date"},"@version":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"Activity\_Status":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"Event":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"Function\_Name":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"Session\_ID":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"Severity":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"User\_Name":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"beat":{"properties":{"hostname":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"name":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"version":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}}}}," **event\_time**":{"type":"date","format":"yyyy/MM/dd HH:mm:ss||yyyy/MM/dd||epoch\_millis"},"host":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"message":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"offset":{"type":"long"},"prospector":{"properties":{"type":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}}}},"source":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"tags":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}},"timestamp":{"type":"text","fields":{"keyword":{"type":"keyword","ignore\_above":256}}}}}}}}

---

<div class="post-metadata">

**Author:** ![Ashish1234](https://avatars.discourse-cdn.com/v4/letter/a/a4c791/32.png) [@Ashish1234](https://discuss.elastic.co/u/Ashish1234)\
**Post date:** [May 9, 2018, 8:26am UTC](https://discuss.elastic.co/t/unable-to-sort-logs-on-the-basis-of-timestamp/131126/2 "2018-05-09T08:26:43Z")

</div>

below are the sample logs  
[DEBUG]:[test]:[09/05/2018 07:06:00]:[323232]:[uploadLogFile]:[PRE\_DEPLOYMENT\_CHECKS]:[323232]:[abcd]  
[DEBUG]:[test]:[09/05/2018 07:06:00]:[323232]:[uploadLogFile]:[PRE\_DEPLOYMENT\_CHECKS]:[323232]:[abcs]  
[INFO]:[test]:[09/05/2018 07:06:00]:[323232]:[getUnTrustedOkHttpClient]:[PRE\_DEPLOYMENT\_CHECKS]:[ajsjwqsqwsqw]  
[INFO]:[test]:[09/05/2018 07:06:00]:[323232]:[getUnTrustedOkHttpClient]:[PRE\_DEPLOYMENT\_CHECKS]:[dwdwedwdwd]

---

<div class="post-metadata">

**Author:** ![polyfractal](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/polyfractal/32/48162_2.png) [@polyfractal](https://discuss.elastic.co/u/polyfractal)\
**Post date:** [May 10, 2018, 5:26pm UTC](https://discuss.elastic.co/t/unable-to-sort-logs-on-the-basis-of-timestamp/131126/3 "2018-05-10T17:26:30Z")

</div>

What exactly is the issue? What do you mean by being unable to sort?

Those logs don't show anything useful, so I'm not sure what the issue is here 😕

---

<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:** [June 7, 2018, 5:26pm UTC](https://discuss.elastic.co/t/unable-to-sort-logs-on-the-basis-of-timestamp/131126/4 "2018-06-07T17:26:31Z")

</div>

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