Splunk Search

Need help in extracting json fields

Nadhiyaa
Path Finder

Hi

Below is my json data format .

 organisations: {   [-] 
    :   {   [+] 
    }   
     adbsafegate.com:   {   [-] 
     active:     0  
     active_selected:    0  
     all:    0  
     on_realm:   0  
    }   
     aeroflot.ru:   {   [-] 
     active:     0  
     active_selected:    0  
     all:    25 
     on_realm:   5  
    }   
     airalgerie.dz: {   [-] 
     active:     0  
     active_selected:    0  
     all:    3  
     on_realm:   1  
    }   
     airastana.com: {   [-] 
     active:     1  
     active_selected:    1  
     all:    3  
     on_realm:   1  
    }

}

i want it to extract like below table format :

organisations on_realm
adbsafegate 0
aeroflot 5
airalgerie 1
airastana 1

Kindly help.Thanks

Tags (1)
0 Karma

jutzasconsist
New Member

Hi Nadhiyaa,

may be this helps you getting started:

\}\s+(?<EXTRACTION1>\w+)|on_realm:\s+(?<EXTRACTION2>\d)

It will extract the lines below your headline "organisations on_realm"

This should also work for extractig all of the relevant data:
^\s+(?\w+):\D+}|(?\w+).\w+:\s+{\s+[-]|\w+:\s+\d+\s+\w+:\s+\d+\s+\w+:\s+\d+\s+(?\w+)|:\s+(?\d+)\s+

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...