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!

[Puzzles] Solve, Learn, Repeat: Dynamic formatting from XML events

This challenge was first posted on Slack #puzzles channelFor a previous puzzle, I needed a set of fixed-length ...

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Stronger Security with Federated Search for S3, GCP SQL & Australian Threat ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...