<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Show a part of message for dasboard stats table in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569240#M198406</link>
    <description>&lt;P&gt;You have at least two different methods of parsing out the message part.&lt;/P&gt;&lt;P&gt;1) (ITWhisperer already showed this solution) find the json part, "fix" it (remove backslashes escaping quotation marks), then use spath on the json data to get the message part.&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_query&amp;gt; &lt;BR /&gt;| rex "(?&amp;lt;json&amp;gt;\{.*\})" &lt;BR /&gt;| eval json=replace(json,"\\\\\"","\"")&lt;BR /&gt;| spath input=json path=message&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It should work but it's a bit... halfhearted because it uses the fact that you have a json structure but it makes too many assumptions about the format and contents of this json.&lt;/P&gt;&lt;P&gt;Therefore you have option&lt;/P&gt;&lt;P&gt;2) Just use a regex to parse out the message value&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_search&amp;gt; &lt;BR /&gt;| rex "\\\"message\\\":\\\"(?&amp;lt;message&amp;gt;.*)\\\"}\"$"&lt;/PRE&gt;&lt;P&gt;Quick and dirty but simple and effective. (I'm not sure whether the closing quote is a part of the event or is it just you quoting it. Adjust the regex accordingly if necessary.&lt;/P&gt;</description>
    <pubDate>Thu, 30 Sep 2021 21:42:13 GMT</pubDate>
    <dc:creator>PickleRick</dc:creator>
    <dc:date>2021-09-30T21:42:13Z</dc:date>
    <item>
      <title>Show a part of message for dasboard stats table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569164#M198375</link>
      <description>&lt;P&gt;I have the following query and I am using it in a dashboard to show the errors categorized.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=myindex sourcetype=mysource_type:app | spath message | regex message="^.*error creating account.*$$"|top message&lt;/LI-CODE&gt;&lt;P&gt;Now, this is working, but it is showing the complete messages. The error messages have the following format most of the time:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;message: Log: "error creating account {\"status\":\"error\",\"message\":\"Error while creating account, 500 - Internal Server Error\"}"&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;Now when the stats table is displayed. I would like to show only the message part from this error message, that is it only needs to show&amp;nbsp;&lt;STRONG&gt;Error while creating an account, 500 - Internal Server Error.&amp;nbsp;&amp;nbsp;&lt;/STRONG&gt;It will be very much helpful someone can point out how I can do this?&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 14:59:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569164#M198375</guid>
      <dc:creator>alwinaugustin</dc:creator>
      <dc:date>2021-09-30T14:59:27Z</dc:date>
    </item>
    <item>
      <title>Re: Show a part of message for dasboard stats table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569176#M198382</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/237077"&gt;@alwinaugustin&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you can do this using the eval command.&lt;/P&gt;&lt;P&gt;So if your field is called message, you have to put in your search:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| eval message=if(like(message,"%Error while creating account, 500%"),"Error while creating an account, 500 - Internal Server Error.",message") &lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 15:23:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569176#M198382</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-09-30T15:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Show a part of message for dasboard stats table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569230#M198405</link>
      <description>&lt;LI-CODE lang="markup"&gt;| makeresults 
| eval _raw="message: Log: \"error creating account {\\\"status\\\":\\\"error\\\",\\\"message\\\":\\\"Error while creating account, 500 - Internal Server Error\\\"}\""



| rex "(?&amp;lt;json&amp;gt;\{[^\}]+\})"
| eval json=replace(json,"\\\\","")
| spath input=json path="message" output=message&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 30 Sep 2021 20:49:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569230#M198405</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-09-30T20:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Show a part of message for dasboard stats table</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569240#M198406</link>
      <description>&lt;P&gt;You have at least two different methods of parsing out the message part.&lt;/P&gt;&lt;P&gt;1) (ITWhisperer already showed this solution) find the json part, "fix" it (remove backslashes escaping quotation marks), then use spath on the json data to get the message part.&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_query&amp;gt; &lt;BR /&gt;| rex "(?&amp;lt;json&amp;gt;\{.*\})" &lt;BR /&gt;| eval json=replace(json,"\\\\\"","\"")&lt;BR /&gt;| spath input=json path=message&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;It should work but it's a bit... halfhearted because it uses the fact that you have a json structure but it makes too many assumptions about the format and contents of this json.&lt;/P&gt;&lt;P&gt;Therefore you have option&lt;/P&gt;&lt;P&gt;2) Just use a regex to parse out the message value&lt;/P&gt;&lt;PRE&gt;&amp;lt;your_search&amp;gt; &lt;BR /&gt;| rex "\\\"message\\\":\\\"(?&amp;lt;message&amp;gt;.*)\\\"}\"$"&lt;/PRE&gt;&lt;P&gt;Quick and dirty but simple and effective. (I'm not sure whether the closing quote is a part of the event or is it just you quoting it. Adjust the regex accordingly if necessary.&lt;/P&gt;</description>
      <pubDate>Thu, 30 Sep 2021 21:42:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Show-a-part-of-message-for-dasboard-stats-table/m-p/569240#M198406</guid>
      <dc:creator>PickleRick</dc:creator>
      <dc:date>2021-09-30T21:42:13Z</dc:date>
    </item>
  </channel>
</rss>

