<?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: json field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560344#M159245</link>
    <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp; now I am able to get the important fields with&amp;nbsp;&lt;SPAN&gt;kvdelim and pairdelim to parse the required key value pairs.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
    <pubDate>Wed, 21 Jul 2021 12:25:42 GMT</pubDate>
    <dc:creator>prasant</dc:creator>
    <dc:date>2021-07-21T12:25:42Z</dc:date>
    <item>
      <title>json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560185#M159199</link>
      <description>&lt;P&gt;Hi Splunk Experts,&lt;/P&gt;&lt;P&gt;Below is a sample event, I have below spath msg.message.details, I am trying to extract certain&amp;nbsp; fields from the details datapath. How can I extract '&lt;STRONG&gt;msg.message.details&lt;/STRONG&gt;' into fields?, I am still a newbie and learning on the go in splunk world, I am guessing to use rex, but is there a way using spath? Our index has structured other json paths eg:y has other spath eg:msg.message.header.correlationId, etc,&amp;nbsp;&lt;/P&gt;&lt;P&gt;{ [-]&lt;BR /&gt;cf_app_id: test123&lt;BR /&gt;cf_app_name: test&lt;BR /&gt;event_type: LogMessage&lt;BR /&gt;&lt;BR /&gt;job_index: ebcf8d13&lt;BR /&gt;message_type: OUT&lt;BR /&gt;msg: { [-]&lt;BR /&gt;level: INFO&lt;BR /&gt;logger: UpdateContact&lt;BR /&gt;message: { [-]&lt;BR /&gt;details: Data{SystemId='null', language='English', parentSourceSystemAction='null', contactId='cf4cae75-28b3', status='Active', birthDate='1991-01-15', eventAction='Create', Accounts=[CustomerAccounts{ Case='000899', accountid='4DA4F29E', contactRelationship=ContactRelationship{expiryDate='', contactType='owner', endDate=''}}],workContact=WorkContact{faxNumber='null', mobileNumber='null', emailAddress='null', phoneNumber='null'},homeContact=HomeContact{faxNumber='null', mobileNumber='null', emailAddress='', phoneNumber='null'},businessAddress=null,personalAddress=[PersonalAddress{addressId='9205', locality='PARK', internationalPostCode='null', internationalState='null', additionalInfo='null', isPrimary='Y', streetNumberStart='null', addressType='null', status='CO', streetNumberStartSuffix='null', postalCode='765', streetNumberEnd='null', streetName='null', country='null', streetNumberEndSuffix='null', streetType='null', state='null', subAddress=SubAddress{buildingName='null', numberStart='null', addressLines=[MIL PDE,], details=[Details{value='null', detailType='null'}, Details{value='null', detailType='null'}]}}],idv=Identification{doc=License{state='null', number='null'}}}&lt;BR /&gt;header: { [-]&lt;BR /&gt;correlationId: 707000J-52f6-10df-00f3-f859-1c5ed&lt;BR /&gt;entityId: cf75-2b3-cb38-cef-a72ad88&lt;BR /&gt;entityName: test&lt;BR /&gt;errorCode: null&lt;BR /&gt;errorMessage: null&lt;BR /&gt;eventName: testevent&lt;BR /&gt;processName: process1&lt;BR /&gt;processStatus: SUCCESS&lt;BR /&gt;serviceName: testservice&lt;BR /&gt;serviceType: Dispatch&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;timestamp: 2021-07-20&lt;BR /&gt;}&lt;BR /&gt;origin: rep&lt;BR /&gt;timestamp: 1626764261880766200&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;Any help is much appreciated.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 10:12:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560185#M159199</guid>
      <dc:creator>prasant</dc:creator>
      <dc:date>2021-07-20T10:12:37Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560188#M159200</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236611"&gt;@prasant&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you please share your sample event in code format? Just use &lt;STRONG&gt;&amp;lt;/&amp;gt; &lt;/STRONG&gt;tool from toolbar.&lt;/P&gt;&lt;P&gt;KV&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 10:22:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560188#M159200</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-20T10:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560193#M159201</link>
      <description>&lt;LI-CODE lang="markup"&gt;Hi Kamlesh,
Appriciate your prompt response. Hope below format helps, this is sample format, the structure is pretty much same as our actual event. Thanks
{ [-]
	cf_app_id: test123
	cf_app_name: test
	event_type: LogMessage
	job_index: ebcf8d13
	message_type: OUT
	msg: { [-]
     level: INFO 
     logger: UpdateContact
     message: { [-]
       details: Data{SystemId='null', language='English', parentSourceSystemAction='null', contactId='cf4cae75-28b3', status='Active', birthDate='1991-01-15', eventAction='Create', Accounts=[CustomerAccounts{ Case='000899', accountid='4DA4F29E', contactRelationship=ContactRelationship{expiryDate='', contactType='owner',  endDate=''}}],workContact=WorkContact{faxNumber='null', mobileNumber='null', emailAddress='null', phoneNumber='null'},homeContact=HomeContact{faxNumber='null', mobileNumber='null', emailAddress='', phoneNumber='null'},businessAddress=null,personalAddress=[PersonalAddress{addressId='9205', locality='PARK', internationalPostCode='null', internationalState='null', additionalInfo='null', isPrimary='Y', streetNumberStart='null', addressType='null', status='CO', streetNumberStartSuffix='null', postalCode='765', streetNumberEnd='null', streetName='null', country='null', streetNumberEndSuffix='null', streetType='null', state='null',  subAddress=SubAddress{buildingName='null', numberStart='null', addressLines=[MIL PDE,], details=[Details{value='null', detailType='null'}, Details{value='null', detailType='null'}]}}],identification=Identification{driverLicense=DriverLicense{state='null', number='null'}}}
       header: { [-]
         correlationId: 707000J-52f6-10df-00f3-f859-1c5ed
         entityId: cf75-2b3-cb38-cef-a72ad88
         entityName: test
         errorCode: null
         errorMessage: null
         eventName: testevent
         processName: process1
         processStatus: SUCCESS
         serviceName: testservice
         serviceType: Dispatch
       }
     }
     
     timestamp: 2021-07-20 
   }
   origin: rep
   timestamp: 1626764261880766200
}&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 Jul 2021 10:43:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560193#M159201</guid>
      <dc:creator>prasant</dc:creator>
      <dc:date>2021-07-20T10:43:39Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560194#M159202</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/236611"&gt;@prasant&lt;/a&gt;&amp;nbsp;&amp;nbsp;&lt;BR /&gt;Your shared JSON is invalid, may be due to you copied from the event bar.&amp;nbsp;You suppose to provide _raw data.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Something like..&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{"msg": {"message": {"details": "Data{SystemId='null', language='English', parentSourceSystemAction='null', contactId='cf4cae75-28b3', status='Active', birthDate='1991-01-15', eventAction='Create', Accounts=[CustomerAccounts{ Case='000899', accountid='4DA4F29E', contactRelationship=ContactRelationship{expiryDate='', contactType='owner',  endDate=''}}],workContact=WorkContact{faxNumber='null', mobileNumber='null', emailAddress='null', phoneNumber='null'},homeContact=HomeContact{faxNumber='null', mobileNumber='null', emailAddress='', phoneNumber='null'},businessAddress=null,personalAddress=[PersonalAddress{addressId='9205', locality='PARK', internationalPostCode='null', internationalState='null', additionalInfo='null', isPrimary='Y', streetNumberStart='null', addressType='null', status='CO', streetNumberStartSuffix='null', postalCode='765', streetNumberEnd='null', streetName='null', country='null', streetNumberEndSuffix='null', streetType='null', state='null',  subAddress=SubAddress{buildingName='null', numberStart='null', addressLines=[MIL PDE,], details=[Details{value='null', detailType='null'}, Details{value='null', detailType='null'}]}}],identification=Identification{driverLicense=DriverLicense{state='null', number='null'}}}header: { [-]correlationId: 707000J-52f6-10df-00f3-f859-1c5edentityId: cf75-2b3-cb38-cef-a72ad88entityName: testerrorCode: nullerrorMessage: nulleventName: testeventprocessName: process1processStatus: SUCCESSserviceName: testserviceserviceType: Dispatch}}"}}}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Well, Your data looks like representation of any Programming Objects. So may be we need to extract thise fields using regex. Can you please share fields names which you expecting?&lt;/P&gt;&lt;P&gt;Meanwhile you can try&amp;nbsp;&amp;nbsp;this?&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;YOUR_SEARCH
| spath path=msg.message.details output=details 
| eval _raw=details | extract pairdelim="\"{,}" kvdelim=":"
| table *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;KV&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 11:40:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560194#M159202</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2021-07-20T11:40:48Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560344#M159245</link>
      <description>&lt;P&gt;Thanks a lot&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/127939"&gt;@kamlesh_vaghela&lt;/a&gt;&amp;nbsp; now I am able to get the important fields with&amp;nbsp;&lt;SPAN&gt;kvdelim and pairdelim to parse the required key value pairs.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 21 Jul 2021 12:25:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/560344#M159245</guid>
      <dc:creator>prasant</dc:creator>
      <dc:date>2021-07-21T12:25:42Z</dc:date>
    </item>
  </channel>
</rss>

