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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...