Splunk Search

passing a query string as token

ManishVilla7
Explorer

how to extract the query stored in form of a key value pair in a lookup and execute the query in a single go in search app.
For ex- |makeresults|eval field1= "index=*|stats count "| --> how can we pass the value in filed1 which is a query and execute it within the same search.
Please help: @somesoni2 @woodcock @martin_mueller @niketnilay

Tags (1)

woodcock
Esteemed Legend

You do this with map, like this:

| makeresults
| eval field1= "index=* | stats count"
| map search="search $field1$"

This construct is particularly useful when creating workflow actions.

0 Karma
Get Updates on the Splunk Community!

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...

New in Observability Cloud - Explicit Bucket Histograms

Splunk introduces native support for histograms as a metric data type within Observability Cloud with Explicit ...