<?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 How do you parse JSON from a specific field? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-JSON-from-a-specific-field/m-p/414068#M73238</link>
    <description>&lt;P&gt;I tried search in the community support section for something similar to my issue.&lt;/P&gt;

&lt;P&gt;I am trying to parse a specific field which is actually in JSON format. Is there a way to parse out anything within the message section. Below is a sample.&lt;/P&gt;

&lt;P&gt;Field name is errorMessage_Field and contains the info below:&lt;/P&gt;

&lt;P&gt;{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/blah"},"instance":{"pointer":"/blah"},"domain":"validation","keyword":"required","message":"object has missing required properties ([\"presosBlahID\"])","required":["presosBlahID"],"missing":["presosBlahID"]}&lt;/P&gt;

&lt;P&gt;Using the JSON entry above, im trying to show a table that just shows:&lt;BR /&gt;
Count   |   Detailed Error Message &lt;BR /&gt;
3            |    Object has missing required properties: presosBlahID&lt;/P&gt;

&lt;P&gt;I realize that using spath is the way to do it but i have not been successful.&lt;/P&gt;

&lt;P&gt;index=index_name sourcetype="sourcetype_name errorMessage_Field="errorMessage earliest=-15h&lt;BR /&gt;
| bucket span=1m _time&lt;BR /&gt;
| stats count by errorMessage_Field &lt;BR /&gt;
| fields count errorMessage_Field&lt;BR /&gt;
| rename count AS "Error Count" &lt;BR /&gt;
| rename errorMessage_Field AS "Detailed Error Message"&lt;/P&gt;

&lt;P&gt;Any assistance is greatly appreciated. &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
    <pubDate>Tue, 29 Sep 2020 20:56:47 GMT</pubDate>
    <dc:creator>joshimeister</dc:creator>
    <dc:date>2020-09-29T20:56:47Z</dc:date>
    <item>
      <title>How do you parse JSON from a specific field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-JSON-from-a-specific-field/m-p/414068#M73238</link>
      <description>&lt;P&gt;I tried search in the community support section for something similar to my issue.&lt;/P&gt;

&lt;P&gt;I am trying to parse a specific field which is actually in JSON format. Is there a way to parse out anything within the message section. Below is a sample.&lt;/P&gt;

&lt;P&gt;Field name is errorMessage_Field and contains the info below:&lt;/P&gt;

&lt;P&gt;{"level":"error","schema":{"loadingURI":"#","pointer":"/definitions/blah"},"instance":{"pointer":"/blah"},"domain":"validation","keyword":"required","message":"object has missing required properties ([\"presosBlahID\"])","required":["presosBlahID"],"missing":["presosBlahID"]}&lt;/P&gt;

&lt;P&gt;Using the JSON entry above, im trying to show a table that just shows:&lt;BR /&gt;
Count   |   Detailed Error Message &lt;BR /&gt;
3            |    Object has missing required properties: presosBlahID&lt;/P&gt;

&lt;P&gt;I realize that using spath is the way to do it but i have not been successful.&lt;/P&gt;

&lt;P&gt;index=index_name sourcetype="sourcetype_name errorMessage_Field="errorMessage earliest=-15h&lt;BR /&gt;
| bucket span=1m _time&lt;BR /&gt;
| stats count by errorMessage_Field &lt;BR /&gt;
| fields count errorMessage_Field&lt;BR /&gt;
| rename count AS "Error Count" &lt;BR /&gt;
| rename errorMessage_Field AS "Detailed Error Message"&lt;/P&gt;

&lt;P&gt;Any assistance is greatly appreciated. &lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:56:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-JSON-from-a-specific-field/m-p/414068#M73238</guid>
      <dc:creator>joshimeister</dc:creator>
      <dc:date>2020-09-29T20:56:47Z</dc:date>
    </item>
    <item>
      <title>Re: How do you parse JSON from a specific field?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-JSON-from-a-specific-field/m-p/414069#M73239</link>
      <description>&lt;P&gt;I've has some issues with JSON where most but not all of it gets parsed.  For those I've written a regex and dropped it into &lt;CODE&gt;props.conf&lt;/CODE&gt; for that particular sourcetype or source.  &lt;/P&gt;

&lt;P&gt;in search to test before adding to .props:&lt;/P&gt;

&lt;P&gt;index=index_name sourcetype=sourcetype_name errorMessage_Field=errorMessage earliest=-15h&lt;BR /&gt;
| bucket span=1m _time&lt;BR /&gt;
| stats count AS "Error Count" by errorMessage_Field&lt;BR /&gt;
| rex field=errorMessage_Field "regex here is getting messed up see below"&lt;BR /&gt;
| eval "Detailed Error Message"=mvzip('message','detail')&lt;BR /&gt;
| table "Error Count" "Detailed Error Message"&lt;/P&gt;

&lt;P&gt;\"message\":\"(?&amp;lt; message&amp;gt;[\w\s]+)\s(\ [\\"(?&amp;lt; detail&amp;gt;[^\]+)&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;there is an artificial space added before "message", the 2nd "[", and "detail" since this editor kept trying to interpret/mess the regex up&lt;/EM&gt;&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:56:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-do-you-parse-JSON-from-a-specific-field/m-p/414069#M73239</guid>
      <dc:creator>marycordova</dc:creator>
      <dc:date>2020-09-29T20:56:53Z</dc:date>
    </item>
  </channel>
</rss>

