<?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 to access a JSON that does not have a field name? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-access-a-JSON-that-does-not-have-a-field-name/m-p/362975#M66150</link>
    <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I've used spath before to access JSON, but the log entry i currently have does not have a name associated to the JSON and i am having a hard time cracking into it. in the example log entry below i might want to extract out the src_ip,a_labels&amp;gt;app, a_labels&amp;gt;env&lt;/P&gt;

&lt;P&gt;raw:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sev=INFO pid=5675 tid=7777567567 rid=0 {"tbo":40,"pn":"name.exe","src_ip":"11.22.33.44""a_labels":[{"app":"appname1"},{"env":"env1"}],"b_labels":[{"app":"appname2"}{"env":"env2"}],"pd":0}


sev=INFO  
pid=5675 
tid=7777567567 
rid=0 
    {
        "tbo":40,
        "pn":"name.exe",
        "src_ip":"11.22.33.44"
        "a_labels":
            [
                {"app":"appname1"},
                {"env":"env1"}
            ],
        "b_labels":
            [
                {"app":"appname2"}
                {"env":"env2"}
            ],
        "pd":0
    }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 29 Sep 2020 13:16:55 GMT</pubDate>
    <dc:creator>wantjoule</dc:creator>
    <dc:date>2020-09-29T13:16:55Z</dc:date>
    <item>
      <title>How to access a JSON that does not have a field name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-access-a-JSON-that-does-not-have-a-field-name/m-p/362975#M66150</link>
      <description>&lt;P&gt;Hi All,&lt;/P&gt;

&lt;P&gt;I've used spath before to access JSON, but the log entry i currently have does not have a name associated to the JSON and i am having a hard time cracking into it. in the example log entry below i might want to extract out the src_ip,a_labels&amp;gt;app, a_labels&amp;gt;env&lt;/P&gt;

&lt;P&gt;raw:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sev=INFO pid=5675 tid=7777567567 rid=0 {"tbo":40,"pn":"name.exe","src_ip":"11.22.33.44""a_labels":[{"app":"appname1"},{"env":"env1"}],"b_labels":[{"app":"appname2"}{"env":"env2"}],"pd":0}


sev=INFO  
pid=5675 
tid=7777567567 
rid=0 
    {
        "tbo":40,
        "pn":"name.exe",
        "src_ip":"11.22.33.44"
        "a_labels":
            [
                {"app":"appname1"},
                {"env":"env1"}
            ],
        "b_labels":
            [
                {"app":"appname2"}
                {"env":"env2"}
            ],
        "pd":0
    }
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 13:16:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-access-a-JSON-that-does-not-have-a-field-name/m-p/362975#M66150</guid>
      <dc:creator>wantjoule</dc:creator>
      <dc:date>2020-09-29T13:16:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a JSON that does not have a field name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-access-a-JSON-that-does-not-have-a-field-name/m-p/362976#M66151</link>
      <description>&lt;P&gt;You would need to extract that json string into a field and then use spath command. Like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | rex "^(\S+\s+){4}(?&amp;lt;json_data&amp;gt;\{.+)" | spath input=json_data
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 21 Mar 2017 16:20:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-access-a-JSON-that-does-not-have-a-field-name/m-p/362976#M66151</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2017-03-21T16:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to access a JSON that does not have a field name?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-access-a-JSON-that-does-not-have-a-field-name/m-p/362977#M66152</link>
      <description>&lt;P&gt;Thank you @somesoni2 but i tried this and it didn't seem to extract the JSON into the field, so the spath didn't work&lt;/P&gt;

&lt;P&gt;Can you explain what is happening in the rex.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Mar 2017 04:00:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-access-a-JSON-that-does-not-have-a-field-name/m-p/362977#M66152</guid>
      <dc:creator>wantjoule</dc:creator>
      <dc:date>2017-03-22T04:00:22Z</dc:date>
    </item>
  </channel>
</rss>

