Dashboards & Visualizations

How do you set an input's conditional change to match a literal * with Simple XML?

andrewcg
Path Finder

I have a problem with users putting just * in test search fields. I am fine with "bob*" but "*" is too much. I would like unset the token if someone put in *. I have changed the input token's name and then added a conditional change, but since * matches everything, I am trying to escape it. I tried \*, but that only matches when you actually input \*

<input type="text" token="tok_user_name_check" searchWhenChanged="false">
  <label>The userid</label>
  <default></default>
  <change>
    <condition value="\*">
      <unset token="tok_user_name"></unset>
    </condition>
    <condition value="*">
      <set token="tok_user_name">$tok_user_name_check$</set>
    </condition>
  </change>
</input>

cphair
Builder

Try condition match="match(value, & quot; \ \ *& quot;)" but without all the interior whitespace. (I added that so the characters would post verbatim.)

snipedown21
Path Finder

This solution for the aforementioned problem works perfect.

Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...