Getting Data In

Modify JSON Objects at indexing time

mdorobek
Path Finder

Hello there,

I have the issue that there are more events in one JSON-Object. Heres an example:

{
category: NetworkSecurityGroupFlowEvent
operationName: NetworkSecurityGroupFlowEvents
properties: { 
Version: 1
flows: [ 
{ 
flows: [ 
{ 
flowTuples: [ 
1531920192,11.11.111.111,12.12.122.122,1608,703,U,O,A
1531920222,11.11.111.111,12.12.122.122,14172,703,T,O,A
]
mac: 000A1A111111
}
]
rule: UserRule_AllowSelfOutBound
}
{ 
flows: [ 
{ 
flowTuples: [ 
1531920192,11.11.111.112,12.12.122.123,14886,703,U,I,A
1531920222,11.11.111.112,12.12.122.123,11717,703,U,I,A
]
mac: 000A1A111111
}
]
rule: UserRule_AllowSelfInBound
}
]
}
resourceId: /SUBSCRIPTIONS/aa11a111-11a1-1111-11a1-aa1111a11aaa /RESOURCEGROUPS/NETZWERK-NETZWERK-PROD-RG/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/HUBNVAHA-NETZWERK-PROD-NSG
systemId: aa11a111-11a1-1111-11a1-aa1111a11aaa
time: 2018-07-18T13:24:10.3603243Z
}  

There are more then one flowTuple in one JSON Object which causes Problems at filtering IP's. Is it possible to modify the events at indexing time to have one event for every tuple like the following example?

{ 
category: NetworkSecurityGroupFlowEvent
operationName: NetworkSecurityGroupFlowEvents
properties: { 
Version: 1
flows: [ 
{ 
flows: [ 
{ 
flowTuples: [ 
1531920192,11.11.111.111,12.12.122.122,1608,703,U,O,A
]
mac: 000A1A111111
}
]
rule: UserRule_AllowSelfOutBound
}
resourceId: /SUBSCRIPTIONS/aa11a111-11a1-1111-11a1-aa1111a11aaa /RESOURCEGROUPS/NETZWERK-NETZWERK-PROD-RG/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/HUBNVAHA-NETZWERK-PROD-NSG
systemId: aa11a111-11a1-1111-11a1-aa1111a11aaa
time: 2018-07-18T13:24:10.3603243Z
}  
{ 
category: NetworkSecurityGroupFlowEvent
operationName: NetworkSecurityGroupFlowEvents
properties: { 
Version: 1
flows: [ 
{ 
flows: [ 
{ 
flowTuples: [ 
1531920222,11.11.111.111,12.12.122.122,14172,703,T,O,A
]
mac: 000A1A111111
}
]
rule: UserRule_AllowSelfOutBound
}
resourceId: /SUBSCRIPTIONS/aa11a111-11a1-1111-11a1-aa1111a11aaa /RESOURCEGROUPS/NETZWERK-NETZWERK-PROD-RG/PROVIDERS/MICROSOFT.NETWORK/NETWORKSECURITYGROUPS/HUBNVAHA-NETZWERK-PROD-NSG
systemId: aa11a111-11a1-1111-11a1-aa1111a11aaa
time: 2018-07-18T13:24:10.3603243Z
}  

and so on..

I did ask a similar question on splunk answers which provides more information. Since noone could give me an answer I try to ask the question differently.

Kind regards
mdorobek

0 Karma

ddrillic
Ultra Champion

It seems best if you do the conversion outside of Splunk. I wonder whether json has similar capabilities to XML and the beloved XSLT for conversions....

0 Karma

jplumsdaine22
Influencer

How are you expecting flowTuples to extract?
The below (as you have in your sample events) is a single object array (and hence will be a single value in splunk)

flowTuples: [ 
 1531920192,11.11.111.111,12.12.122.122,1608,703,U,O,A
 1531920222,11.11.111.111,12.12.122.122,14172,703,T,O,A
 ]

correctly I think it should be

flowTuples: [ 
 [1531920192,11.11.111.111,12.12.122.122,1608,703,U,O,A] ,
 [1531920222,11.11.111.111,12.12.122.122,14172,703,T,O,A ]
 ]

If you cannot fix the underlying event you could do something in search - what does the flowTuples field in Splunk look like when it has multiple values? (ie ...search to get a flowTuples with multiple values ... | head 1 | fields flowTuples

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.
Get Updates on the Splunk Community!

Maximizing the Value of Splunk ES 8.x

Splunk Enterprise Security (ES) continues to be a leader in the Gartner Magic Quadrant, reflecting its pivotal ...

Operationalizing TDIR: Building a More Resilient, Scalable SOC

Optimizing SOC workflows with a unified, risk-based approach to Threat Detection, Investigation, and Response ...

Introducing .conf Stories Series!

“.conf Stories” Series – First Feature: Rich Mahlerwein   Every year .conf brings together some of the most ...