<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Prevent Wildcard In User Input in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341033#M101114</link>
    <description>&lt;P&gt;Hi BlueSocket, &lt;/P&gt;

&lt;P&gt;Thanks for the quick response. I'm actually looking for a relatively straightforward way (if any) to prevent user from using wildcard in Text Input. But I think you just enlightened me to use drop down instead for that purpose. (I guess input validation with js would work for Text Input too). Thanks!!&lt;/P&gt;</description>
    <pubDate>Fri, 09 Jun 2017 10:11:57 GMT</pubDate>
    <dc:creator>JohannLiebert92</dc:creator>
    <dc:date>2017-06-09T10:11:57Z</dc:date>
    <item>
      <title>Prevent Wildcard In User Input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341031#M101112</link>
      <description>&lt;P&gt;Hi everyone,&lt;/P&gt;

&lt;P&gt;I've developed a dashboard with text input for my user. However, I do not want my users to use wildcard in the input, is there any way to disable/prevent user from using wildcard (*)?&lt;/P&gt;

&lt;P&gt;Thanks!!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 09:47:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341031#M101112</guid>
      <dc:creator>JohannLiebert92</dc:creator>
      <dc:date>2017-06-09T09:47:13Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Wildcard In User Input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341032#M101113</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Could you provide a drop down which is populated with all of the possible search items? Or are you looking for validation of input fields before they are submitted?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 10:01:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341032#M101113</guid>
      <dc:creator>BlueSocket</dc:creator>
      <dc:date>2017-06-09T10:01:04Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Wildcard In User Input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341033#M101114</link>
      <description>&lt;P&gt;Hi BlueSocket, &lt;/P&gt;

&lt;P&gt;Thanks for the quick response. I'm actually looking for a relatively straightforward way (if any) to prevent user from using wildcard in Text Input. But I think you just enlightened me to use drop down instead for that purpose. (I guess input validation with js would work for Text Input too). Thanks!!&lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 10:11:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341033#M101114</guid>
      <dc:creator>JohannLiebert92</dc:creator>
      <dc:date>2017-06-09T10:11:57Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Wildcard In User Input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341034#M101115</link>
      <description>&lt;P&gt;It's easier to do the drop down, seriously &lt;/P&gt;</description>
      <pubDate>Fri, 09 Jun 2017 10:15:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341034#M101115</guid>
      <dc:creator>BlueSocket</dc:creator>
      <dc:date>2017-06-09T10:15:21Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Wildcard In User Input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341035#M101116</link>
      <description>&lt;P&gt;Preventing wildcards in dashboard text form fields is relatively easy. Example preventing * asterisks from being entered. The result is a bold red error message and the search is not executed.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="user_name"&amp;gt;
  &amp;lt;label&amp;gt;Username&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;&amp;lt;!--event trigger on submit to check for * in the user_name field--&amp;gt;
      &amp;lt;condition match="not like($value$,&amp;amp;quot;*&amp;amp;quot;)"&amp;gt;
        &amp;lt;!--if input contains *, eval sets a token which stops the search and displays the html reject--&amp;gt;
       &amp;lt;set token="logLevelTok"&amp;gt;$value$&amp;lt;/set&amp;gt;
    &amp;lt;/condition&amp;gt;
    &amp;lt;condition&amp;gt;&amp;lt;!--no * is in user_name field--&amp;gt;
       &amp;lt;unset token="logLevelTok"&amp;gt;&amp;lt;/unset&amp;gt;
    &amp;lt;/condition&amp;gt;
   &amp;lt;/change&amp;gt;
&amp;lt;/input&amp;gt;
  &amp;lt;html rejects="$logLevelTok$"&amp;gt;
     &amp;lt;div&amp;gt;
       &amp;lt;p style="color:red;font-weight:bold;font-size:150%;text-align:left;"&amp;gt;
       Asterisks &amp;amp;quot;*&amp;amp;quot; are not permitted.
       &amp;lt;/p&amp;gt;
     &amp;lt;/div&amp;gt;
  &amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;,If you need an input text form field, you can prevent wildcards by tokens and conditions. Example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="text" token="user_name"&amp;gt;
  &amp;lt;label&amp;gt;Username&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;&amp;lt;!--event triggered by submit, checks user_name field for astericks--&amp;gt;
      &amp;lt;condition match="not like($value$,&amp;amp;quot;*&amp;amp;quot;)"&amp;gt;
        &amp;lt;!--if input contains *, eval sets a token which stops the search and displays the html reject--&amp;gt;
       &amp;lt;set token="logLevelTok"&amp;gt;$value$&amp;lt;/set&amp;gt;
    &amp;lt;/condition&amp;gt;
    &amp;lt;condition&amp;gt;&amp;lt;!--no * is in user_name field--&amp;gt;
       &amp;lt;unset token="logLevelTok"&amp;gt;&amp;lt;/unset&amp;gt;
    &amp;lt;/condition&amp;gt;
   &amp;lt;/change&amp;gt;
&amp;lt;/input&amp;gt;
  &amp;lt;html rejects="$logLevelTok$"&amp;gt;
     &amp;lt;div&amp;gt;
       &amp;lt;p style="color:red;font-weight:bold;font-size:150%;text-align:left;"&amp;gt;
       Asterisks &amp;amp;quot;*&amp;amp;quot; are not permitted.
       &amp;lt;/p&amp;gt;
     &amp;lt;/div&amp;gt;
  &amp;lt;/html&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The output is bold letters warning the user about wild cards just below the form field.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Nov 2017 18:42:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341035#M101116</guid>
      <dc:creator>christopher_mcc</dc:creator>
      <dc:date>2017-11-22T18:42:44Z</dc:date>
    </item>
    <item>
      <title>Re: Prevent Wildcard In User Input</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341036#M101117</link>
      <description>&lt;P&gt;&lt;STRONG&gt;Option 1: Using eval with &lt;CODE&gt;case()&lt;/CODE&gt; to set the token if asterix is not entered in the text box&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Text Box validation&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="text" token="selText"&amp;gt;
      &amp;lt;label&amp;gt;Enter Log Level (like INFO, WARN, ERROR, FATAL etc)&amp;lt;/label&amp;gt;
      &amp;lt;change&amp;gt;
        &amp;lt;eval token="tokLogLevel"&amp;gt;case(len($value$)&amp;amp;gt;0 AND NOT like($value$,"%*%"),$value$)&amp;lt;/eval&amp;gt;
      &amp;lt;/change&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html rejects="$tokLogLevel$"&amp;gt;
        &amp;lt;div style="color:red;text-align:center;font-weight:bold;font-size:150%"&amp;gt;
          Log Level does not accept asterix (*)!!!
        &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
      &amp;lt;table depends="$tokLogLevel$"&amp;gt;
        &amp;lt;title&amp;gt;Log Level Volume&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index="_internal" sourcetype=splunkd log_level="$tokLogLevel$"
          | stats count by log_level
          | appendpipe [| makeresults
          | eval log_level="$tokLogLevel$",count=0
          | fields - _time]
          | dedup log_level&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following is the run anywhere dashboard based on one of my previous answers: &lt;A href="https://answers.splunk.com/answers/513440/how-to-validate-text-field-token-without-using-jav.html"&gt;https://answers.splunk.com/answers/513440/how-to-validate-text-field-token-without-using-jav.html&lt;/A&gt; (I had assumed in my answer that SimpleXML will use JavaScript regular expression and match would work asterix but it did not &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt; )&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Second Option: Using Dummy Search with eval match() to set the token if asterix is not entered in the text box:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
  &amp;lt;label&amp;gt;Text Box validation Option 2&amp;lt;/label&amp;gt;
  &amp;lt;fieldset submitButton="false"&amp;gt;
    &amp;lt;input type="text" token="selText" searchWhenChanged="true"&amp;gt;
      &amp;lt;label&amp;gt;Enter Log Level (like INFO, WARN, ERROR, FATAL etc)&amp;lt;/label&amp;gt;
    &amp;lt;/input&amp;gt;
  &amp;lt;/fieldset&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;|  makeresults
|  eval testData="$selText$"
|  eval tokLogLevel=case(len(testData)&amp;amp;gt;0 AND match(testData,"^[^\*]+$"),testData)
|  table testData tokLogLevel
    &amp;lt;/query&amp;gt;
    &amp;lt;done&amp;gt;
      &amp;lt;condition match="isnull($result.tokLogLevel$) OR isnull($form.selText$)"&amp;gt;
        &amp;lt;unset token="tokLogLevel"&amp;gt;&amp;lt;/unset&amp;gt;
      &amp;lt;/condition&amp;gt;
      &amp;lt;condition&amp;gt;
        &amp;lt;set token="tokLogLevel"&amp;gt;$result.tokLogLevel$&amp;lt;/set&amp;gt;
      &amp;lt;/condition&amp;gt;
    &amp;lt;/done&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;row&amp;gt;
    &amp;lt;panel&amp;gt;
      &amp;lt;html rejects="$tokLogLevel$"&amp;gt;
        &amp;lt;div style="color:red;text-align:center;font-weight:bold;font-size:150%"&amp;gt;
          Log Level does not accept asterix (*)!!!
        &amp;lt;/div&amp;gt;
      &amp;lt;/html&amp;gt;
      &amp;lt;table depends="$tokLogLevel$"&amp;gt;
        &amp;lt;title&amp;gt;Log Level Volume&amp;lt;/title&amp;gt;
        &amp;lt;search&amp;gt;
          &amp;lt;query&amp;gt;index="_internal" sourcetype=splunkd log_level="$tokLogLevel$"
          | stats count by log_level
          | appendpipe [| makeresults
          | eval log_level="$tokLogLevel$",count=0
          | fields - _time]
          | dedup log_level&amp;lt;/query&amp;gt;
          &amp;lt;earliest&amp;gt;-24h@h&amp;lt;/earliest&amp;gt;
          &amp;lt;latest&amp;gt;now&amp;lt;/latest&amp;gt;
          &amp;lt;sampleRatio&amp;gt;1&amp;lt;/sampleRatio&amp;gt;
        &amp;lt;/search&amp;gt;
        &amp;lt;option name="count"&amp;gt;20&amp;lt;/option&amp;gt;
        &amp;lt;option name="dataOverlayMode"&amp;gt;none&amp;lt;/option&amp;gt;
        &amp;lt;option name="drilldown"&amp;gt;cell&amp;lt;/option&amp;gt;
        &amp;lt;option name="percentagesRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="rowNumbers"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="totalsRow"&amp;gt;false&amp;lt;/option&amp;gt;
        &amp;lt;option name="wrap"&amp;gt;true&amp;lt;/option&amp;gt;
      &amp;lt;/table&amp;gt;
    &amp;lt;/panel&amp;gt;
  &amp;lt;/row&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 22 Nov 2017 22:55:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Prevent-Wildcard-In-User-Input/m-p/341036#M101117</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-11-22T22:55:29Z</dc:date>
    </item>
  </channel>
</rss>

