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!

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