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

Observability Simplified: Combining User Experience, Application Performance & ...

Tech Talk Observability Simplified: Combining User Experience, Application Performance & Network ...

Event Series May & June: From Network Visibility to Service Intelligence

Unifying the Network: Moving from Alert Noise to Service Intelligence with Splunk ITSI In today’s hybrid ...

Global Splunk User Group Events: May + June 2026

Your Splunk Community Awaits: Discover Upcoming User Group Events Worldwide    Staying ahead in the fast-paced ...