Splunk Search

Construct map command query in eval statement


I am having trouble constructing a search command in an Eval statement. I stripped it down to its most basic form to troubleshoot, but I still can't get that to work.

| makeresults 
| eval test = "search earliest=1576263600 latest=1576512000 index=security sourcetype=host_info | head 10" 
| map search="$test$"

I also tried this which was recommended in a different splunk answers post, but that still didn't work for me on Splunk version 7.1.6.

| makeresults 
| eval test = "earliest=1576263600 latest=1576512000 index=security sourcetype=host_info | head 10" 
| map search="search [| makeresults | eval evaltest=$test$ | return $evaltest]"
0 Karma


try giving double $ sign . passed variables should be in $$ sign.

| map search="search [| makeresults | eval evaltest="$$test$$" | return $evaltest]"

Get Updates on the Splunk Community!

Your Guide to SPL2 at .conf24!

So, you’re headed to .conf24? You’re in for a good time. Las Vegas weather is just *chef’s kiss* beautiful in ...

Get ready to show some Splunk Certification swagger at .conf24!

Dive into the deep end of data by earning a Splunk Certification at .conf24. We're enticing you again this ...

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Now On-Demand Join us to learn more about how you can leverage Service Level Objectives (SLOs) and the new ...