Splunk Search

Transaction command: How to get the latest value of field after transcation command?

koshyk
Super Champion

As per the given example , I was looking to find the "value" of a field which is part of the 1st leg of the transaction

eg

2019-04-29 14:00:01  empID=123 empName=Joe sequence=DAY1 page=adminPage.jsp
2019-04-29 14:00:02  empID=123 department=Marketing sequence=DAY2 page=secondPage.jsp

...   | transaction empID startswith="DAY1" endswith="DAY2" maxspan=10s keeporphans=true

If I do the above, but do a

...   
| transaction empID startswith="DAY1" endswith="DAY2" maxspan=10s keeporphans=true
| stats count by empID,page

I will get two rows, because of "page" being present in 1st leg and 2nd leg

If I need to just the "page" value from the 1st leg of transaction, what should i Do?
(I can't do latest(page) after Transaction, as the time is both same. Also I don't have control over what happens above transaction command NOR in the transaction command as it is part of a wider macro search)

I'm expecting an output of

empID,page
123,adminPage.jsp;secondPage.jsp
0 Karma
1 Solution

somesoni2
Revered Legend

Give this a try

........
 | transaction empID startswith="DAY1" endswith="DAY2" maxspan=10s keeporphans=true mvlist=t
| eval page=mvindex(page,0)
 | stats count by empID,page

View solution in original post

0 Karma

somesoni2
Revered Legend

Give this a try

........
 | transaction empID startswith="DAY1" endswith="DAY2" maxspan=10s keeporphans=true mvlist=t
| eval page=mvindex(page,0)
 | stats count by empID,page
0 Karma

koshyk
Super Champion

thanks mate for the idea

0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...