Getting Data In

Dealing with badly structured json events

david_rose
Communicator

I am pulling in some json events that are poorly structured (at least for my needs). Specifically, I need to be able to tie the VULNS data to its ip address, which is above it. But since they are not nested, splunk is not able to make the connection. Is there any way to tie the IP address to the data below it or readjust the nesting of the event in a search?

Example data below

vulnerable_hosts: [ [-] 
         { [-] 
            ip_address:  xxx.xxx.xxx.xxx 
            vulns: [ [-] 
             { [-] 
                risk_level:  High 
                service_port:  443 
                service_protocol:  TCP 
                title:  SSL/TLS server supports RC4 ciphers 
             } 
             { [-] 
                risk_level:  Medium 
                service_port:  80 
                service_protocol:  TCP 
                title:  TCP timestamp requests enabled 
             } 
             { [-] 
                risk_level:  Medium 
                service_port:  443 
                service_protocol:  TCP 
                title:  SSL certificate is signed with weak hash function: SHA1 
             } 
           ] 
         } 
         { [-] 
            ip_address:  yyy.yyy.yyy.yyy 
            vulns: [ [-] 
             { [-] 
                risk_level:  Urgent 
                service_port:  161 
                service_protocol:  UDP 
                title:  SNMP is enabled and may be vulnerable 
             } 
             { [-] 
                risk_level:  Low 
                service_port:  0 
                service_protocol:  ICMP 
                title:  ICMP timestamp requests enabled 
             } 
           ] 
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

You need a two-step approach:

... | spath vulnerable_hosts{} output=vulnerable_hosts | mvexpand vulnerable_hosts | spath input=vulnerable_hosts

First you extract the objects inside the vulnerable_hosts array, then you turn them into individual events, finally you extract the content of those objects.

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

You need a two-step approach:

... | spath vulnerable_hosts{} output=vulnerable_hosts | mvexpand vulnerable_hosts | spath input=vulnerable_hosts

First you extract the objects inside the vulnerable_hosts array, then you turn them into individual events, finally you extract the content of those objects.

david_rose
Communicator

Thanks Martin. But with this method, how can I connect the vulnerability to the the correct ip ?

david_rose
Communicator

Ignore that, it was there, just not presented in the events. You rock!

Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...