Splunk Search

join results if _time between startTime and finishTime

justme
New Member

I have one source that provides startTime and finishTime of a test.
I also have a log file that gives me _time and event

I would like to produce a search that will give me the following results

startTime finishTime testResult event1,event2,event3

where the _time on event1,event2,and event3 is between startTime and finishTime

For example

Source 1:
StartTime FinishTime Response
1286345749443 1286345749455 passed
1286345749460 1286345749465 passed
1286345749470 1286345749475 failed

Source 2 timeStamp Event
1286345749471 SocketException
1286345749474 IOException

Result should be
StartTime FinishTime Result Event
1286345749470 1286345749475 failed SocketException, IOException

Tags (1)
0 Karma

woodcock
Esteemed Legend

This should do it:

sourcetype=source1 | map search="sourcetype=source2 earliest=$StartTime$ latest=$FinishTime | stats earliest(timestamp) AS StartTime latest(timestamp) AS FinishTime list(Event) as Events"
0 Karma

justme
New Member

Source 1:

StartTime FinishTime Response
1286345749443 1286345749455 passed
1286345749460 1286345749465 passed
1286345749470 1286345749475 failed

Source 2
timeStamp Event
1286345749471 SocketException
1286345749474 IOException

Result should be
StartTime FinishTime Result Event
1286345749470 1286345749475 failed SocketException, IOException

0 Karma

Genti
Splunk Employee
Splunk Employee

can you provide sample log files for both sources?

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...