Getting Data In

How to extract new fields from a JSON array?

James_ACN
Loves-to-Learn Everything

Hi All!

How to extract and create different fields by transforms when there is an array (JSON) with several fields with the same name but different values?
For example, the "text" field in the first case means "action", in the second the "text" field means "hostname".
Just like "port" that appears twice would have to be identified as src_port and dst_port.

Sample_log_json.png

Sample:

"{ 
   detail: { 
      indicators: [
       { 
         filterId: [
         ]

         id1
         objectTypeport
         objectValue445
         relatedEntities: [
         ]

       }
       {
         filterId: [
         ]

         id2
         objectTypetext
         objectValueReset
         relatedEntities: [
         ]

       }
       {
         filterId: [
         ]

         id3
         objectTypeport
         objectValue36880
         relatedEntities: [
       ]
       }
       {

       filterId: [
         ]

         id6
         objectTypetext
         objectValueSERVERWIN01
         relatedEntities: [
         ]

       }
       { 
         filterId: [
         ]

         id7
         objectTypedetection_name
         objectValueMicrosoft Windows SMB Information Disclosure Vulnerability (CVE-2017-0147)
         relatedEntities: [
         ]

 
   }"


Thanks!

James 

Labels (3)
0 Karma

James_ACN
Loves-to-Learn Everything

Hi All!

I still haven't been able to solve this problem.

Does anyone have any outline suggestions?

 

Thanks!

 

James \°/

0 Karma

PickleRick
SplunkTrust
SplunkTrust

Firstly, it looks like an output of spath command, not the automatic json extraction (the automatic extraction doesn't understand json structure and just uses "final" field names).

Secondly, how would you distinguish between different ports? You can of course retrieve specific value of multivalue field by mvindex() but are you sure that src port will always be firts value? And so on?

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...