Splunk Dev

Query criteria to calculate Time Span

sanjayiowa
New Member

Hi,

Is there a way to calculate a time span from start to stop position using java sdk.

e.g.
11012012 12:00:01 PM Start
...
....

11012012 12:30:01 PM Stop

and
result would be 30 min.

Thanks,
Sanjay

Tags (2)
0 Karma
1 Solution

alacercogitatus
SplunkTrust
SplunkTrust

If this log file is in Splunk, you could try:

search_foo | transaction host startswith="Start" endswith="Stop"

The resulting "duration" field will tell you how long it took.

http://www.splunk.com/base/Documentation/5.0/SearchReference/Transaction

View solution in original post

alacercogitatus
SplunkTrust
SplunkTrust

If this log file is in Splunk, you could try:

search_foo | transaction host startswith="Start" endswith="Stop"

The resulting "duration" field will tell you how long it took.

http://www.splunk.com/base/Documentation/5.0/SearchReference/Transaction

dwaddle
SplunkTrust
SplunkTrust

If the answer solved your problem, please click the check box to the left to "accept" the answer.

0 Karma

sanjayiowa
New Member

Thanks for prompt response. I was able to get desire result.

0 Karma

sanjayiowa
New Member

Those events are in a log file. I would like to get 30 min as answer or list of those time period if there are multiple Start/Stop (matching first to first)

0 Karma

alacercogitatus
SplunkTrust
SplunkTrust

Are you trying to parse this from events returned from a search? Where are you getting these times from?

0 Karma
Get Updates on the Splunk Community!

Enter the Agentic Era with Splunk AI Assistant for SPL 1.4

  🚀 Your data just got a serious AI upgrade — are you ready? Say hello to the Agentic Era with the ...

Feel the Splunk Love: Real Stories from Real Customers

Hello Splunk Community,    What’s the best part of hearing how our customers use Splunk? Easy: the positive ...

Data Management Digest – November 2025

  Welcome to the inaugural edition of Data Management Digest! As your trusted partner in data innovation, the ...