<?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: How can I build a Dashboard/Search to use optional Text inputs? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266343#M80066</link>
    <description>&lt;P&gt;That would work, but I have some events that contain only three of the four fields (UserID PID IP) - some events do not have SPID and/or IP. So if I input data into the UserID and PID text boxes, leaving SPID and IP as &lt;CODE&gt;"*"&lt;/CODE&gt; ( &lt;CODE&gt;UserID=Larry PID=1 SPID=* IP=*&lt;/CODE&gt;), that does not work because the event contains fields UserID PID and does not have SPID and IP. Having "*" for SPID and IP implies that the event contains the two fields.&lt;/P&gt;</description>
    <pubDate>Tue, 06 Dec 2016 21:25:50 GMT</pubDate>
    <dc:creator>dpanych</dc:creator>
    <dc:date>2016-12-06T21:25:50Z</dc:date>
    <item>
      <title>How can I build a Dashboard/Search to use optional Text inputs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266340#M80063</link>
      <description>&lt;P&gt;I am trying to build a dashboard with multiple Text inputs that are optional. Say I have 4 Text input boxes: UserID, PID, SPID, and IP, with Default/Load values being "*". The initial search will return all results. But say I want to just search a UserID and want to bring back all data when UserID = "This_is_a_user". If I'm searching only on UserID, I don't want the other fields being searched on. How can I do this? &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(index=AUTH OR index=EXTERNAL_APP) UserID=$userid$ PID=$pid$ SPID=$spid$ IP=$ip$
| table AppID _time UsreID Session IP SystemID PID SPID Page Function FName  MI  LName Address Email 
| sort _time    
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 12:02:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266340#M80063</guid>
      <dc:creator>dpanych</dc:creator>
      <dc:date>2020-09-29T12:02:27Z</dc:date>
    </item>
    <item>
      <title>Re: How can I build a Dashboard/Search to use optional Text inputs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266341#M80064</link>
      <description>&lt;P&gt;By default the search filters have a logic AND between them, if you do not specify the same explicitly. All you need to do is add OR between all the filters you want to use.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index=AUTH OR index=EXTERNAL_APP) AND (UserID=$userid$ OR PID=$pid$ OR SPID=$spid$ OR IP=$ip$)
 | table _time AppID UsreID Session IP SystemID PID SPID Page Function FName  MI  LName Address Email 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also in your table change _time to be the first column and result will be automatically sorted based on first field. This should save you one additional final sort query,&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 19:37:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266341#M80064</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-06T19:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: How can I build a Dashboard/Search to use optional Text inputs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266342#M80065</link>
      <description>&lt;P&gt;If &lt;CODE&gt;userid, pid, spid and ip&lt;/CODE&gt; are the four tokens, one for each of the text box then by setting &lt;CODE&gt;text inputs&lt;/CODE&gt;'s &lt;CODE&gt;Default&lt;/CODE&gt; value as &lt;CODE&gt;*&lt;/CODE&gt; it should work the way you want. Since by &lt;CODE&gt;*&lt;/CODE&gt; you imply that Splunk should search all the values for the field to which this text input token (in case you left it blank) got set to. &lt;/P&gt;

&lt;P&gt;Additionally, update the &lt;CODE&gt;token prefix&lt;/CODE&gt; and &lt;CODE&gt;token suffix&lt;/CODE&gt; to &lt;CODE&gt;" (double quotes)&lt;/CODE&gt; so that you get the desired results as &lt;CODE&gt;(double quotes)tokenValue(double quotes)&lt;/CODE&gt; if token is not set and/or a default of &lt;CODE&gt;*&lt;/CODE&gt; is chosen then it results in the token value to become &lt;CODE&gt;"*"&lt;/CODE&gt; which might be more friendly &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;

&lt;P&gt;Hence by just setting one of the four tokens and leaving other three blank the three on which you don't want to search will become &lt;CODE&gt;"*"&lt;/CODE&gt; which is equal to do not search anything specific on them which gives u the desired result of search all values of the three fields which I chose as blank and only filter on one of them which is not blank. &lt;/P&gt;

&lt;P&gt;Then below query should work fine the way you require it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; (index=AUTH OR index=EXTERNAL_APP) UserID=$userid$ PID=$pid$ SPID=$spid$ IP=$ip$
 | table AppID _time UsreID Session IP SystemID PID SPID Page Function FName  MI  LName Address Email 
 | sort _time    
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 06 Dec 2016 19:50:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266342#M80065</guid>
      <dc:creator>gokadroid</dc:creator>
      <dc:date>2016-12-06T19:50:26Z</dc:date>
    </item>
    <item>
      <title>Re: How can I build a Dashboard/Search to use optional Text inputs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266343#M80066</link>
      <description>&lt;P&gt;That would work, but I have some events that contain only three of the four fields (UserID PID IP) - some events do not have SPID and/or IP. So if I input data into the UserID and PID text boxes, leaving SPID and IP as &lt;CODE&gt;"*"&lt;/CODE&gt; ( &lt;CODE&gt;UserID=Larry PID=1 SPID=* IP=*&lt;/CODE&gt;), that does not work because the event contains fields UserID PID and does not have SPID and IP. Having "*" for SPID and IP implies that the event contains the two fields.&lt;/P&gt;</description>
      <pubDate>Tue, 06 Dec 2016 21:25:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266343#M80066</guid>
      <dc:creator>dpanych</dc:creator>
      <dc:date>2016-12-06T21:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: How can I build a Dashboard/Search to use optional Text inputs?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266344#M80067</link>
      <description>&lt;P&gt;Since you have variety of events and conditions, you should use separate dropdown/checkbox inputs between each field dropdown to explicitly select what you need. By default you can have all AND selected. &lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 04:02:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-build-a-Dashboard-Search-to-use-optional-Text-inputs/m-p/266344#M80067</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2016-12-07T04:02:31Z</dc:date>
    </item>
  </channel>
</rss>

