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
Get Updates on the Splunk Community!

See just what you’ve been missing | Observability tracks at Splunk University

Looking to sharpen your observability skills so you can better understand how to collect and analyze data from ...

Weezer at .conf25? Say it ain’t so!

Hello Splunkers, The countdown to .conf25 is on-and we've just turned up the volume! We're thrilled to ...

How SC4S Makes Suricata Logs Ingestion Simple

Network security monitoring has become increasingly critical for organizations of all sizes. Splunk has ...