Splunk Search

Nearest Event of Type=X

blurblebot
Communicator

How can I take an event with a given key(a)/value(b) pair and find the temporally nearest event with key(c)/value(d)? I thought transaction would be the way to go, but I've used it enough to know that I must not know what I need to know about it, if that's my best avenue.

The idea is that given an event:

Oct 26, 2032 src_ip=132.32.23.4 proto=udp

How can I find the very next event (only) containing

Oct 26, 2032 src_ip=132.32.23.4 rectype=tcpsession

OR

the nearest previous recent event (only) containing

Oct 26, 2032 src_ip=132.32.23.4 rectype=ipflow

OR better yet, both.

For me, the transaction would be:

search index=whatevs | transaction src_ip | search (rectype=tcpsession) (rectype=ipflow)

But this, even if given a maxspan, seems to often return an event set that while matches, doesn't necessarily limit the results or stick to my specified maxspan.

Any takers?

I'll buy you a pony.... Thanks

-s

Tags (1)
1 Solution

Lowell
Super Champion

Have you tried using startswith/endswith?

index=whatevs | transaction src_ip startswith=("rectype=ipflow") endswith=("rectype=tcpsession")

Does that get you any closer?

View solution in original post

Lowell
Super Champion

Have you tried using startswith/endswith?

index=whatevs | transaction src_ip startswith=("rectype=ipflow") endswith=("rectype=tcpsession")

Does that get you any closer?

blurblebot
Communicator

I come here before I go to documentation, apparently. I'm lonely.

0 Karma
Get Updates on the Splunk Community!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

Splunk is officially part of Cisco

Revolutionizing how our customers build resilience across their entire digital footprint.   Splunk ...

Splunk APM & RUM | Planned Maintenance March 26 - March 28, 2024

There will be planned maintenance for Splunk APM and RUM between March 26, 2024 and March 28, 2024 as ...