Splunk Search

Subsearch using time from lookup in main search

adamblock2
Path Finder

I am performing a lookup in a main search which returns earliest_event and latest_event timestamp values.  I would like to use these timestamp values as parameters for a subsearch.  The search would be similar to the following:

index=foo
...........
| lookup lookuptable.csv session_id OUTPUTNEW session_id, earliest_event, latest_event
...........
| append
[ search index=bar earliest=earliest_event latest=latest_event
...........]



The time parameters for the subsearch are not being accepted, though.

Is there a different way that this can be accomplished?

Labels (1)
0 Karma

ITWhisperer
SplunkTrust
SplunkTrust

Subsearches generally execute before the main search, which essentially means you cannot pass information from the main search to the subsearch as you are trying to do.

However, you might be able to do something with the map command rather than the append command, but this has performance implications, so proceed with caution. 😀

0 Karma
Get Updates on the Splunk Community!

A Season of Skills: New Splunk Courses to Light Up Your Learning Journey

There’s something special about this time of year—maybe it’s the glow of the holidays, maybe it’s the ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to ...

Announcing the Migration of the Splunk Add-on for Microsoft Azure Inputs to Officially Supported Splunk ...

Splunk Observability for AI

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