# Retrieving sub string from message

**URL:** <https://discuss.elastic.co/t/retrieving-sub-string-from-message/193263>\
**Category:** Kibana\
**Created:** [August 1, 2019, 7:04am UTC](https://discuss.elastic.co/t/retrieving-sub-string-from-message/193263 "2019-08-01T07:04:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Harshavardhan\_Reddy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harshavardhan_reddy/32/48409_2.png) [@Harshavardhan\_Reddy](https://discuss.elastic.co/u/Harshavardhan_Reddy)\
**Post date:** [August 1, 2019, 7:04am UTC](https://discuss.elastic.co/t/retrieving-sub-string-from-message/193263/1 "2019-08-01T07:04:17Z")

</div>

Message :

DIR\* completeFile: /user/spark/applicationHistory/.07aeece0-2474-4a9e-a4f3-a6f511d47000 is closed by DFSClient\_NONMAPREDUCE\_1865763448\_1

so , i want to fetch DFSClient\_NONMAPREDUCE\_1865763448\_1 (this is sub string in message)

when i applied filter operation in kibana , i am getting whole message . but instead of that can i fetch only DFSClient\_NONMAPREDUCE\_1865763448\_1 (sub string )

will it possible ?

---

<div class="post-metadata">

**Author:** ![flash1293](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/flash1293/32/41227_2.png) [@flash1293](https://discuss.elastic.co/u/flash1293)\
**Post date:** [August 8, 2019, 3:52pm UTC](https://discuss.elastic.co/t/retrieving-sub-string-from-message/193263/2 "2019-08-08T15:52:39Z")

</div>

The best solution is to do this kind of thing during ingest. This means you analyze your message field before you push it into Elasticsearch and create a separate field that just contains the substring you want. You can do that for example with Logstash ([by providing a pattern of the message](https://www.elastic.co/guide/en/logstash/current/plugins-filters-grok.html)).

If you absolutely want to do it in Kibana after data ingest, you can create a [scripted field](https://www.elastic.co/blog/using-painless-kibana-scripted-fields) that does the same thing, but on demand when you are querying data. You can do everything with scripted fields just as with regular fields, e.g. using it in a filter operation. Be aware that this solution doesn't scale well to terabytes of data.

---

<div class="post-metadata">

**Author:** ![Harshavardhan\_Reddy](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/harshavardhan_reddy/32/48409_2.png) [@Harshavardhan\_Reddy](https://discuss.elastic.co/u/Harshavardhan_Reddy)\
**Post date:** [August 9, 2019, 6:57am UTC](https://discuss.elastic.co/t/retrieving-sub-string-from-message/193263/3 "2019-08-09T06:57:04Z")

</div>

Thanks@flash1293 .

---

<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:** [September 6, 2019, 6:57am UTC](https://discuss.elastic.co/t/retrieving-sub-string-from-message/193263/4 "2019-09-06T06:57:07Z")

</div>

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