Splunk Search

How do I edit my transaction search to make sure that a certain event is present between the start and end events?

moe44688
New Member

Hi guys,

I am monitoring suspicious user activity using the transaction command. For example, if EventCodes X, Y, and Z (in this order) show up for the same user within 24 hours, an alert will be sent out. So I have most of my search complete. My problem is, I need to make sure that between X and Z the event Y is present.

.....| transaction user startswith=(EventCode=X) endswith=(EventCode=Z) | .....

I appreciate your help!
Thanks

0 Karma
1 Solution

lguinn2
Legend

You could easily do it like this

 ..... 
| transaction user startswith=(EventCode=X) endswith=(EventCode=Z) 
| where EventCode=Y
....

Once the transaction is created, you can search for EventCode = Y and Splunk will retain only the events that have EventCode=Y somewhere within the transaction.

View solution in original post

lguinn2
Legend

You could easily do it like this

 ..... 
| transaction user startswith=(EventCode=X) endswith=(EventCode=Z) 
| where EventCode=Y
....

Once the transaction is created, you can search for EventCode = Y and Splunk will retain only the events that have EventCode=Y somewhere within the transaction.

moe44688
New Member

Thank you very much! This worked perfectly.

0 Karma
Get Updates on the Splunk Community!

Index This | What’s a riddle wrapped in an enigma?

September 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

BORE at .conf25

Boss Of Regular Expression (BORE) was an interactive session run again this year at .conf25 by the brilliant ...

OpenTelemetry for Legacy Apps? Yes, You Can!

This article is a follow-up to my previous article posted on the OpenTelemetry Blog, "Your Critical Legacy App ...