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!

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 ...

What's new in Splunk Cloud Platform 9.1.2312?

Hi Splunky people! We are excited to share the newest updates in Splunk Cloud Platform 9.1.2312! Analysts can ...