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!

Upcoming Webinar: Unmasking Insider Threats with Slunk Enterprise Security’s UEBA

Join us on Wed, Dec 10. at 10AM PST / 1PM EST for a live webinar and demo with Splunk experts! Discover how ...

.conf25 technical session recap of Observability for Gen AI: Monitoring LLM ...

If you’re unfamiliar, .conf is Splunk’s premier event where the Splunk community, customers, partners, and ...

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...