Splunk Search

How to pull end time instead of start time from my transaction search?

tondapi
New Member

Hi,

The search below is retrieving start time (due to transaction), but I need to pull end time and I don't know the exact command. Please help me to pull end date instead of start time.

index=os  sourcetype="syslog d"  (job_name =WHK9225 )  | transaction job_name job_number
Tags (2)
0 Karma

aljohnson_splun
Splunk Employee
Splunk Employee

Hi @Tondapi,

Given a search like:

index=os sourcetype="syslog d" (job_name =WHK9225 ) 
| transaction job_name job_number

You can get the end time by utilizing the duration field that gets creating via the transaction command. However, duration gives you back a number of seconds. So I personally would add the duration count to the _time field and use the eval command's function stftime() to format it to something all nice and human.

So you could add this to your search:

eval end_time = strftime(duration + _time, "%F %T")

where %F and %T are whatever time format variables you want to use.

Read more on eval functions here.

P.S. You can verify that the end_time is what it should be by adding something like:

... | table job_name job_number _time duration end_time

P.P.S.

alt text

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