Splunk Search

Transaction command: How to get the pair up multiple "startswith", but single "endswith" events?

koshyk
Super Champion

hi
We have events something like below

2019-04-30 11:00:01 page=Login.jsp action=login  userid=1234 comment="User opened a session"
2019-04-30 11:01:01 page=Login.jsp action=login  userid=1234 comment="User might have opened another session"
2019-04-30 11:02:01 page=Logout.jsp action=logout userid=1234 comment="User logged out session"

But when user "logsout", that means he has completely logged out of all sessions

When I do a

...
| transaction userid startswith=(action="login") endswith=(action="logout") maxspan=1h keepevicted=true

I was looking for output as a Single Transaction, but currently it comes up as "TWO" txn events; as it pairs the closest/nearby events ONLY

# Transaction Output1
2019-04-30 11:01:01 page=Login.jsp action=login  userid=1234 comment="User might have opened another session"
2019-04-30 11:02:01 page=Logout.jsp action=logout userid=1234 comment="User logged out session"

# Transaction Output2
2019-04-30 11:00:01 page=Login.jsp action=login  userid=1234 comment="User opened a session"

Any options to make it as "SINGLE" output? as the user have logged out of system, so pairing with above conditions should pair both "logins" to a single logout

I was looking for OUPUT like below

# Single Transaction Output
2019-04-30 11:00:01 page=Login.jsp action=login  userid=1234 comment="User opened a session"
2019-04-30 11:01:01 page=Login.jsp action=login  userid=1234 comment="User might have opened another session"
2019-04-30 11:02:01 page=Logout.jsp action=logout userid=1234 comment="User logged out session"
0 Karma
Get Updates on the Splunk Community!

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

Splunk Enterprise Security 8.x: The Essential Upgrade for Threat Detection, ...

Watch On Demand the Tech Talk on November 6 at 11AM PT, and empower your SOC to reach new heights! Duration: ...

Splunk Observability as Code: From Zero to Dashboard

For the details on what Self-Service Observability and Observability as Code is, we have some awesome content ...