Splunk Search

Can you do conditionals in searches where the action is to add/change the search string?

j4adam
Communicator

I did a lot of reading last night about eval ifs and read several posts that danced around the edge of being relevant enough to help me.

My situation is this:

I have a dashboard that has a table that's fueled by ~4 search tokens and I wanted to add a check box that would add another column to the table if checked. The original plan was to do (psuedo code):

if (checkbox is checked) append another field to my table command in the search. Else leave as it is.

So far I've been unable to find out if this is possible. I've read a lot of posts about people hiding panels by editing the XML. I'd like a more elegant solution than simply having two separate panels and inverting their visibility with the check box.

0 Karma

sundareshr
Legend

Try this run anywhere sample. You should be able to copy this, paste it in to your search window and see the results

index=_internal | table [| makeresults | eval search="_time sourcetype"." source" | table search]
0 Karma

sundareshr
Legend

See if this works

your base search | table [| makeresults | eval search="field1 field2".$fieldnamefromcheckbox$ | table search]
0 Karma

j4adam
Communicator

That didn't work, but maybe I did it wrong.

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 ...