Splunk Search

Find time range matching events in another log - subquery?

mvgetz
Engager

I am new to splunk and cannot figure out how to do this - I have start and end transactions in a webAPI log that I pull with a query. What I need to do is get all the events from an engine log that occur during each transaction. No other matching fields between the two logs except time. Here is my main query -

source="rest.log" | transaction sessionId maxevents=2 | where duration>10

I am envisioning a subquery that would do something like: source="engine" maxtime=transactionmaxtime mintime-transactionmintime

Any help would be appreciated. Thanks.

lguinn2
Legend

I am no expert with the map command, but you could try this:

source="rest.log" 
| transaction sessionId maxevents=2 | where duration > 10
| eval starttime =strftime(_time,"%m/%d/%Y:%H:%M:%S")
| eval endtime =strftime(start + duration"%m/%d/%Y:%H:%M:%S")
| map search="search source::engine earliest::$starttime$ latest::$endtime$" maxsearches=100
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!

Unlocking Unified Insights: New Gigamon Federated Search App for Splunk

In today’s data-heavy environment, organizations are caught in a data distribution dilemma. As data volumes ...

GA: New Data Management App in Splunk Platform

Streamlining Data Management: Introducing a unified experience in Splunk Managing data at scale shouldn’t feel ...

Announcing Modern Navigation: A New Era of Splunk User Experience

We are excited to introduce the Modern Navigation feature in the Splunk Platform, available to both cloud and ...