# Add grok patterns on unformatted message in Kibana visualization

**URL:** https://discuss.elastic.co/t/add-grok-patterns-on-unformatted-message-in-kibana-visualization/293379
**Category:** Kibana
**Created:** [January 3, 2022, 7:44pm UTC](https://discuss.elastic.co/t/add-grok-patterns-on-unformatted-message-in-kibana-visualization/293379 "2022-01-03T19:44:59Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![vee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vee/32/55759_2.png) [@vee](https://discuss.elastic.co/u/vee)
#### Post date: [January 3, 2022, 7:44pm UTC](https://discuss.elastic.co/t/add-grok-patterns-on-unformatted-message-in-kibana-visualization/293379/1 "2022-01-03T19:44:59Z")

</div>

Hi there, am trying to create a "metric visualization" to show the count of the "number of instances matching a text pattern", but do not see that field within the list of eligible fields when trying to use.  
From the mapping, I do see it's a "text" field. Can we use grok filters on a field (say, log message) within a Kibana visualization? Or can they be used only within logstash to ingest data into elastic?

Here's what I mean:

Each document ingested into Elastic contains a text field called "log" with "_ **SQLException** _" (somewhere within certain documents).

I am looking for a way to dashboard the total number of occurrences of "SQLException" in the text field called "log".

Thanks!

---

<div class="post-metadata">

### Author: ![seanziee](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/seanziee/32/45151_2.png) [@seanziee](https://discuss.elastic.co/u/seanziee)
#### Post date: [January 3, 2022, 10:11pm UTC](https://discuss.elastic.co/t/add-grok-patterns-on-unformatted-message-in-kibana-visualization/293379/2 "2022-01-03T22:11:20Z")

</div>

Not sure if I understand your question, but if you want to visualize a field, it must be of the type `keyword`. If it's not, it won't appear on the terms aggregation for a visual.

You cannot "grok" within kibana, that must be done before in logstash or in an ingest pipeline. But you can use the filters aggregation where you can have the data split by fieldA:instanceA\* and fieldA:instanceB\* for example.

---

<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: [January 31, 2022, 10:12pm UTC](https://discuss.elastic.co/t/add-grok-patterns-on-unformatted-message-in-kibana-visualization/293379/3 "2022-01-31T22:12:11Z")

</div>

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