Getting Data In

Trying to parse my Json into a table

dperry
Communicator

this is the format:

{
"epoch": "1485892851.94944",
"id": "3952418",
"name": "WMI Performance Adapter",
"new_attrs": "{\"DisplayName\":\"WMI Performance Adapter\",\"ServiceName\":\"wmiApSrv\",\"enabled\":\"Manual\",\"state\":\"Running\",\"User\":\"localSystem\"}",
"new_scan_id": "513186",
"node_environment_id": "2",
"node_id": "153",
"node_name": "servername",
"node_primary_node_group_id": "68",
"old_attrs": "{\"DisplayName\":\"WMI Performance Adapter\",\"ServiceName\":\"wmiApSrv\",\"enabled\":\"Manual\",\"state\":\"Stopped\",\"User\":\"localSystem\"}",
"old_scan_id": "513150",
"path": "{services,windows}",
"status": "modified",
"type": "services",
"updated_at": "2017-01-31 20:00:51.949442"
}

trying to use the spath

Tags (3)
0 Karma
1 Solution

rsennett_splunk
Splunk Employee
Splunk Employee

I believe this is what you are looking for:
I selected one field from new_attr and old_attr because it is the only one that differs. Otherwise you can't see what's happening.

 index=blah sourcetype=blah 
| spath input=new_attrs 
|rename state AS newState
|spath input=old_attrs
|rename state AS oldState
|table newState oldState

But you would simply rename the ones you wanted. ie rename state as newState, DisplayName AS newDisplay, ServiceName AS Fred

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!

View solution in original post

0 Karma

rsennett_splunk
Splunk Employee
Splunk Employee

I believe this is what you are looking for:
I selected one field from new_attr and old_attr because it is the only one that differs. Otherwise you can't see what's happening.

 index=blah sourcetype=blah 
| spath input=new_attrs 
|rename state AS newState
|spath input=old_attrs
|rename state AS oldState
|table newState oldState

But you would simply rename the ones you wanted. ie rename state as newState, DisplayName AS newDisplay, ServiceName AS Fred

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma

dperry
Communicator

Thanks Producer! This is along the lines of what I was visioning.

0 Karma

rsennett_splunk
Splunk Employee
Splunk Employee

woohoo! Excellent. 🙂

With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!
0 Karma
Get Updates on the Splunk Community!

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...

Splunk APM: New Product Features + Community Office Hours Recap!

Howdy Splunk Community! Over the past few months, we’ve had a lot going on in the world of Splunk Application ...

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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