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!

Splunk Classroom Chronicles: Training Tales and Testimonials (Episode 2)

Welcome to the "Splunk Classroom Chronicles" series, created to help curious, career-minded learners get ...

Index This | I am a number but I am countless. What am I?

January 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  Happy New Year! We’re ...

What’s New in Splunk Enterprise 9.4: Tools for Digital Resilience

PLATFORM TECH TALKS What’s New in Splunk Enterprise 9.4: Tools for Digital Resilience Thursday, February 27, ...