Splunk Search

Transaction duration not working as expected

dowdag
Engager
| transaction CheckNumber startswith="Tender" endswith="PrintIntercept\:\:PrintXML finished" 
| top  CheckNumber TimeStamp duration Info   showcount=false showperc=false

I am getting back data but the duration column is 0, what did I miss?

0 Karma

evania
Splunk Employee
Splunk Employee

Hi @dowdag ,

Did you have a chance to check out any answers? If it worked, please resolve this post by approving it! If your problem is still not solved, keep us updated so that someone else can help you.

Thanks for posting!

0 Karma

niketn
Legend

@dowdag have you tried the following? Also after the transaction command have you validated that the two expected events are getting actually correlated or not? Can you add some sample events for startswith and endswith condition (mock/anonymize any sensitive information)?

 <yourCurrentSearch>
 | transaction CheckNumber startswith="Tender" endswith="PrintIntercept\:\:PrintXML finished" 
 | sort 0 - duration
 | table CheckNumber TimeStamp duration Info   

Ideally you should try using stats for this kind of correlation which should work faster

 <yourCurrentSearch> CheckNumber=* ("Tender" OR "PrintIntercept::PrintXML finished")
 | eval EventType=case(searchmatch("Tender"),"start",searchmatch("PrintIntercept::PrintXML finished"),"finish")
 | stats values(EventType) as EventType min(_time) as _time max(_time) as LatestTime values(Info) as Info by CheckNumber
 | search EventType="Tender" AND EventType="PrintIntercept::PrintXML finished" 
 | eval duration=LatestTime-_time
 | fields - LatestTime
 | sort 0 - duration
 | table CheckNumber _time duration Info
____________________________________________
| makeresults | eval message= "Happy Splunking!!!"
0 Karma
Get Updates on the Splunk Community!

Introducing the Splunk Community Dashboard Challenge!

Welcome to Splunk Community Dashboard Challenge! This is your chance to showcase your skills in creating ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer Certification at ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...