<?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: Get only parsed JSON fields using spath in Splunk Dev</title>
    <link>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538947#M9677</link>
    <description>&lt;P&gt;Yes, removing _raw and _time as well. The important step is the selecting of recalib_stats field after the rex which removes the bulk of the other fields - the special fields beginning with an underscore have to be remove individually.&lt;/P&gt;</description>
    <pubDate>Mon, 08 Feb 2021 09:14:26 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2021-02-08T09:14:26Z</dc:date>
    <item>
      <title>Get only parsed JSON fields using spath</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538931#M9672</link>
      <description>&lt;P&gt;I have a below JSON&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN class="t a"&gt;&lt;SPAN class="t"&gt;Recalibration&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Stats&lt;/SPAN&gt; &lt;SPAN class="t"&gt;json&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; {"&lt;/SPAN&gt;&lt;SPAN class="t"&gt;modelid&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;30013&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;champion_gini&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt; &lt;SPAN class="t"&gt;0.8274502273019728&lt;/SPAN&gt;&lt;SPAN&gt;, "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;recalibResult&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;CASE&lt;/SPAN&gt; &lt;SPAN class="t"&gt;I&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Champion&lt;/SPAN&gt; &lt;SPAN class="t"&gt;Retained&lt;/SPAN&gt;&lt;SPAN&gt;", "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;challenger_gini&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt; &lt;SPAN class="t"&gt;0.8013221831674033&lt;/SPAN&gt;&lt;SPAN&gt;, "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;recalibDate&lt;/SPAN&gt;&lt;SPAN&gt;" &lt;/SPAN&gt;&lt;SPAN class="t"&gt;:&lt;/SPAN&gt;&lt;SPAN&gt; "&lt;/SPAN&gt;&lt;SPAN class="t"&gt;2020-05-01&lt;/SPAN&gt;&lt;SPAN&gt;"}&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now to get the JSON fields I have to explicitly mention field names using table/fields. My JSON can get different fields from source so I want to get only parsed fields from JSON by not explicitly mentioning their names. Using below query is giving me all the unwanted fields as well.&lt;/P&gt;&lt;P&gt;index = abx sourcetype = gmdevops_rome source="/axp/gnics/orchestra/dev/romedata/logs/model_run_qc.log" "Recalibration Stats json"&lt;BR /&gt;| rex field=_raw "Recalibration Stats json : (?&amp;lt;recalib_stats&amp;gt;.+)"&lt;BR /&gt;| spath input=recalib_stats&lt;BR /&gt;| table *&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 08:04:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538931#M9672</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2021-02-08T08:04:11Z</dc:date>
    </item>
    <item>
      <title>Re: Get only parsed JSON fields using spath</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538933#M9673</link>
      <description>&lt;P&gt;Not sure what the question is? Are you trying to remove the "unwanted" fields without mentioning which fields are wanted?&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 08:12:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538933#M9673</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-02-08T08:12:46Z</dc:date>
    </item>
    <item>
      <title>Re: Get only parsed JSON fields using spath</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538937#M9674</link>
      <description>&lt;P&gt;Yes, I want only parsed fields from JSON. If I use | table * then I want only those fields that are present in JSON. Unwanted fields are date_hour, _raw, _time , date_second etc.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 08:22:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538937#M9674</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2021-02-08T08:22:06Z</dc:date>
    </item>
    <item>
      <title>Re: Get only parsed JSON fields using spath</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538943#M9675</link>
      <description>&lt;P&gt;Remove everything apart from recalib_stats after the rex, then remove recalib_stats after the spath&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = abx sourcetype = gmdevops_rome source="/axp/gnics/orchestra/dev/romedata/logs/model_run_qc.log" "Recalibration Stats json"
| rex field=_raw "Recalibration Stats json : (?&amp;lt;recalib_stats&amp;gt;.+)"
| fields recalib_stats
| spath input=recalib_stats
| fields - recalib_stats
| table *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 08:59:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538943#M9675</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-02-08T08:59:18Z</dc:date>
    </item>
    <item>
      <title>Re: Get only parsed JSON fields using spath</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538944#M9676</link>
      <description>&lt;P&gt;It'll be like:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index = abx sourcetype = gmdevops_rome source="/axp/gnics/orchestra/dev/romedata/logs/model_run_qc.log" "Recalibration Stats json"
| rex field=_raw "Recalibration Stats json : (?&amp;lt;recalib_stats&amp;gt;.+)"
| fields recalib_stats
| spath input=recalib_stats
| fields - recalib_stats, _raw, _time
| table *&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 08 Feb 2021 09:07:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538944#M9676</guid>
      <dc:creator>nagar57</dc:creator>
      <dc:date>2021-02-08T09:07:13Z</dc:date>
    </item>
    <item>
      <title>Re: Get only parsed JSON fields using spath</title>
      <link>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538947#M9677</link>
      <description>&lt;P&gt;Yes, removing _raw and _time as well. The important step is the selecting of recalib_stats field after the rex which removes the bulk of the other fields - the special fields beginning with an underscore have to be remove individually.&lt;/P&gt;</description>
      <pubDate>Mon, 08 Feb 2021 09:14:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Dev/Get-only-parsed-JSON-fields-using-spath/m-p/538947#M9677</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-02-08T09:14:26Z</dc:date>
    </item>
  </channel>
</rss>

