# Writing GROK for tomcat logs

**URL:** <https://discuss.elastic.co/t/writing-grok-for-tomcat-logs/124263>\
**Category:** Logstash\
**Created:** [March 16, 2018, 10:16am UTC](https://discuss.elastic.co/t/writing-grok-for-tomcat-logs/124263 "2018-03-16T10:16:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Vivek\_Samaga](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vivek_samaga/32/43285_2.png) [@Vivek\_Samaga](https://discuss.elastic.co/u/Vivek_Samaga)\
**Post date:** [March 16, 2018, 10:16am UTC](https://discuss.elastic.co/t/writing-grok-for-tomcat-logs/124263/1 "2018-03-16T10:16:14Z")

</div>

Am trying to parse Tomcat logs using GROK filter my logs has the below format  
`03/14/18 02:01:26 Event Created in BPPM: 512461 in 6ms`

The last field **6ms** field is average response time of the app which i want to have as INTEGER so that it can be aggregatable in KIBANA how to achieve this using GROK.

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [March 16, 2018, 7:04pm UTC](https://discuss.elastic.co/t/writing-grok-for-tomcat-logs/124263/2 "2018-03-16T19:04:21Z")

</div>

Quoting the grok filter documentation:

> Optionally you can add a data type conversion to your grok pattern. By default all semantics are saved as strings. If you wish to convert a semantic’s data type, for example change a string to an integer then suffix it with the target data type. For example %{NUMBER:num:int} which converts the num semantic from a string to an integer. Currently the only supported conversions are int and float.

---

<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:** [April 13, 2018, 7:04pm UTC](https://discuss.elastic.co/t/writing-grok-for-tomcat-logs/124263/3 "2018-04-13T19:04:32Z")

</div>

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