Splunk Search

Time duration

chaitu99
Explorer

Hi,

03/22/2013 05:27:59.603 Message 1
03/22/2013 05:27:59.920 Message 1
03/22/2013 05:28:00.245 Message 1
03/22/2013 05:28:00.561 PROTOCOL 5
03/22/2013 05:28:00.876 Message
03/22/2013 05:28:01.202 FACTOR 6
03/22/2013 05:28:01.518 Message 9
03/22/2013 05:28:01.520 Message 9

I need duration between ("message 1" just before PROTOCOL 5) AND Message 9 just after FACTOR 6

but i have written query below like..

source="$SOURCE" |transaction startswith=("Message 1") endswith=("Message 9")|search ("PROTOCOL 5")|stats count perc95(duration) as VALUE

but that is not working because it is taking first message 1 timestamp value but i need just before PROTOCOL 5 message value.

Please let me know how to go ahead.

Tags (1)
0 Karma
1 Solution

rechteklebe
Path Finder

Change the time frame to 05:28:00.245 - 05:28:01.518. Should work.

View solution in original post

0 Karma

rechteklebe
Path Finder

Change the time frame to 05:28:00.245 - 05:28:01.518. Should work.

0 Karma

rechteklebe
Path Finder

I think it depends on the fields you defined in your environment. Are there any defined fields "startTime" "EndTime" or any other fields which could refer to each event?

Or is there no time fields and all fields are the same for message 1 e.g.?

0 Karma

chaitu99
Explorer

say there is no time stamp then how can we get the time difference?

is there any alternative to get time difference without that?

0 Karma

rechteklebe
Path Finder

You can also try using this:

source="$SOURCE" |transaction startswith=("05:28:00.245 Message 1") endswith=("05:28:01.518 Message 9")|search ("PROTOCOL 5")|stats count perc95(duration) as VALUE

I think your timestamp should also be available in the event itself..like this:

Splunk timestamp --> [timestamp, message]

0 Karma

chaitu99
Explorer

actually here time stamps are not constant. main thing is we need to find the time difference as stated above.
could you please help us?

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas

Why Splunk Customers Should Attend Cisco Live 2026 Las Vegas     Cisco Live 2026 is almost here, and this ...

What Is the Name of the USB Key Inserted by Bob Smith? (BOTS Hint, Not the Answer)

Hello Splunkers,   So you searched, “what is the name of the usb key inserted by bob smith?”  Not gonna lie… ...

Automating Threat Operations and Threat Hunting with Recorded Future

    Automating Threat Operations and Threat Hunting with Recorded Future June 29, 2026 | Register   Is your ...