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
Get Updates on the Splunk Community!

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...

.conf24 | Learning Tracks for Security, Observability, Platform, and Developers!

.conf24 is taking place at The Venetian in Las Vegas from June 11 - 14. Continue reading to learn about the ...

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...