# Grok pattern or stanza for parsing elasticsearch slow logs?

**URL:** <https://discuss.elastic.co/t/grok-pattern-or-stanza-for-parsing-elasticsearch-slow-logs/24638>\
**Category:** Logstash\
**Created:** [June 30, 2015, 3:32pm UTC](https://discuss.elastic.co/t/grok-pattern-or-stanza-for-parsing-elasticsearch-slow-logs/24638 "2015-06-30T15:32:27Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![GordonM](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@GordonM](https://discuss.elastic.co/u/GordonM)\
**Post date:** [June 30, 2015, 3:32pm UTC](https://discuss.elastic.co/t/grok-pattern-or-stanza-for-parsing-elasticsearch-slow-logs/24638/1 "2015-06-30T15:32:28Z")

</div>

Any existing grok patterns (or existing grok stanza) for elasticsearch logs? In particular the slow logs? (index\_indexing and index\_search)?

These are the logs located in a typical install in /var/log/elasticsearch

There is a tutorial here but it is out of date and does not work. ([http://blog.sematext.com/2015/01/19/grok-elasticsearch-logs-with-logstash/](http://blog.sematext.com/2015/01/19/grok-elasticsearch-logs-with-logstash/))

---

<div class="post-metadata">

**Author:** ![warkolm](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/warkolm/32/39224_2.png) [@warkolm](https://discuss.elastic.co/u/warkolm)\
**Post date:** [July 2, 2015, 4:23am UTC](https://discuss.elastic.co/t/grok-pattern-or-stanza-for-parsing-elasticsearch-slow-logs/24638/2 "2015-07-02T04:23:41Z")

</div>

We're hoping to get json logging into ES (I'm hoping for 2.0 :p) which will negate this.

But I haven't seen anything to help sorry.

---

<div class="post-metadata">

**Author:** ![cschotke](https://avatars.discourse-cdn.com/v4/letter/c/4da419/32.png) [@cschotke](https://discuss.elastic.co/u/cschotke)\
**Post date:** [July 2, 2015, 9:15pm UTC](https://discuss.elastic.co/t/grok-pattern-or-stanza-for-parsing-elasticsearch-slow-logs/24638/3 "2015-07-02T21:15:07Z")

</div>

We use these patterns:  
index\_search: "[%{TIMESTAMP\_ISO8601:logtime}][%{LOGLEVEL:log\_level}\s\*][%{DATA:es\_slowquery\_type}]\s\*[%{DATA:es\_host}]\s\*[%{DATA:es\_index}]\s\*[%{DATA:es\_shard}]\s_took[%{DATA:es\_duration}],\s_took\_millis[%{DATA:es\_duration\_ms:float}],\s_types[%{DATA:es\_types}],\s_stats[%{DATA:es\_stats}],\s_search\_type[%{DATA:es\_search\_type}],\s_total\_shards[%{DATA:es\_total\_shards:float}],\s_source[%{GREEDYDATA:es\_source}],\s_extra\_source[%{GREEDYDATA:es\_extra\_source}],"

index\_indexing: "[%{TIMESTAMP\_ISO8601:log\_time}][%{LOGLEVEL:log\_level}\s\*][%{DATA:es\_slowquery\_type}]\s\*[%{DATA:es\_host}]\s\*[%{DATA:es\_index}]\s\*[%{DATA:es\_shard}]\s_took[%{DATA:es\_duration}],\s_took\_millis[%{DATA:es\_duration\_ms:float}],\s_type[%{DATA:es\_type}],\s_id[%{DATA:es\_id}],\s_routing[%{DATA:es\_routing}],\s_source[%{GREEDYDATA:es\_source}]"

---

<div class="post-metadata">

**Author:** ![GordonM](https://avatars.discourse-cdn.com/v4/letter/g/977dab/32.png) [@GordonM](https://discuss.elastic.co/u/GordonM)\
**Post date:** [July 11, 2015, 5:35pm UTC](https://discuss.elastic.co/t/grok-pattern-or-stanza-for-parsing-elasticsearch-slow-logs/24638/4 "2015-07-11T17:35:27Z")

</div>

A long overdue thanks for the update @warkolm and especially for sharing your pattern @cschotke!

---

<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:** [July 6, 2017, 5:34am UTC](https://discuss.elastic.co/t/grok-pattern-or-stanza-for-parsing-elasticsearch-slow-logs/24638/5 "2017-07-06T05:34:56Z")

</div>


