Splunk Search

How to change the time range for a subsearch?

rameshlpatel
Communicator

Hi,

I am creating a search that will take date range from datetime field that I have created above. However, inside that search I am using a subsearch which needs last week's avg data. To get that, I have to fetch last week data and make an average for it.

How do I apply last week's time range for the subsearch?

Kindly assist.

Tags (2)
0 Karma

martin_mueller
SplunkTrust
SplunkTrust

You can set the inner time range using explicit earliest and latest:

outer search ... [search earliest=-w latest=now inner search ...] ...

That will override the outer time range for the inner search.

Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...