Splunk Search

Transaction to Correlate Events Occuring Close to One Another

bcarr12
Path Finder

Apologies if this has already been answered...I can't seem to find a way to get Splunk to correlate events into a single transaction.

Here is an example of the use case:

2014-10-22 11:40:32,596 INFO in.ABC_123 - <43975 MessageInbound LastMkt=MKT LastPx=108.2013 LastNum=123456 Side=1 Symbol=TEST

2014-10-22 11:40:32,900 INFO in.ABC_123 - <43975 MessageInbound LastMkt=MKT LastPx=108.2013 LastNum=123456 Side=2 Symbol=TEST

Both events occur within milliseconds of eachother, so I assume one requirement would be a maxpause=1s in the transaction. The one value that will be different is Side. In general, Side can only be equal to 1 or 2. I need a way to identify any transaction that occurs where LastMkt, LastPx, LastNum, and Symbol are identical in both events, but Side is opposite. I can't use startswith and endswith because it is not a given that Side=1 will always be the starting point (they can be interchanged at any time). I was thinking if there was a way to use an eval within the transaction to indicate that the distinct count of Side was more than 1 maybe?

Ultimately I am trying to create a search that only returns transactions where the above conditions are met and filter out everything else.

Some notes...
These events always occur in pairs of 2 like I posted above, and at most they occur within 1 second of one another.

Tags (2)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

You could try this:

base search | transaction maxspan=1s LastMkt LastPx LastNum Symbol

That'll do the grouping on those for to-be-equal fields, and will honour the "within one second" part. However, that won't make sure that exactly two events are grouped together with different Side values. You can filter that out afterwards though:

... | search Side=1 Side=2 eventcount=2

Those two Side=x don't contradict each other because Side is not a multivalue field.

View solution in original post

martin_mueller
SplunkTrust
SplunkTrust

You could try this:

base search | transaction maxspan=1s LastMkt LastPx LastNum Symbol

That'll do the grouping on those for to-be-equal fields, and will honour the "within one second" part. However, that won't make sure that exactly two events are grouped together with different Side values. You can filter that out afterwards though:

... | search Side=1 Side=2 eventcount=2

Those two Side=x don't contradict each other because Side is not a multivalue field.

bcarr12
Path Finder

This is perfect, thank you! I didn't realize you could run a second search following the transaction to narrow it down, this gives me exactly what I am looking for.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...