Splunk Search

Using search keyword or where keyword

nirmalya2006
Path Finder

Hi All

I have data in the below fomat

Country={UK}, Question=Where do you live, Answer=London 
Country={USA}, Question=Where do you live, Answer=New York 
Country={UK}, Question=What is you pet, Answer=dog 
Country={USA}, Question=What is you pet, Answer=cat

... and so on

I have a drop down in my dashboard that selects the market.
I have a static option 'All' with value as *.
But using the * my below query breaks.

| index=myindex
| where Country="{"."$country$"."}"
| table Country, Question, Answer

When I select any specific country it works, but it breaks when I select the All option
I found by trial and error that I have to use search keyword instead of where when it comes to use asterisk *.
But search key word doesn't go with the expression that I am using, so I have to use where.

I am confused as to which keyword to use or is there any other way I can do it.
Can someone help with some guidance.

Thanks

Tags (1)
0 Karma

HiroshiSatoh
Champion

I think that I should use the search command.

| search Country="{$country$}"

$country$=*,UK,USA
0 Karma
Get Updates on the Splunk Community!

Index This | What goes away as soon as you talk about it?

May 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this month’s ...

What's New in Splunk Observability Cloud and Splunk AppDynamics - May 2025

This month, we’re delivering several new innovations in Splunk Observability Cloud and Splunk AppDynamics ...

Getting Started with Splunk Artificial Intelligence, Insights for Nonprofits, and ...

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...