<?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: Dashboard to query optional fields in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413206#M119143</link>
    <description>&lt;P&gt;Yes, you are right this will not work in that case. This is because you are searching &lt;CODE&gt;User=ut1234 OR Id=*&lt;/CODE&gt;&lt;BR /&gt;
In order to write correct search query, you would need to add only those fields which are available in all the events.  OR else you would need to find a workaround &lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xxxx | fillnull value="NA" User |search  Service=$serviceToken$ Id=$idToken$  User=$userToken$ 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 21 May 2018 12:05:40 GMT</pubDate>
    <dc:creator>mayurr98</dc:creator>
    <dc:date>2018-05-21T12:05:40Z</dc:date>
    <item>
      <title>Dashboard to query optional fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413203#M119140</link>
      <description>&lt;P&gt;My log file is:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;TimeStamp=20180521095103123 Service=ABC12 User=ut1234 Id=12345678 Msg=ttttttttttttt&lt;/LI&gt;
&lt;LI&gt;TimeStamp=20180521095103456 Service=ABC12 Id=12345678 Msg=xxxxxxxxxxxx&lt;/LI&gt;
&lt;LI&gt;TimeStamp=20180521095103723 Service=ABC12 User=ut1234 Msg=yyyyyyyyyyyyyyyy&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I want a dashboard in which I can search for Service, User, Id.&lt;BR /&gt;
I made three input fields with default="*".&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt; &lt;/LI&gt;
&lt;LI&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;      Service&lt;/LI&gt;
&lt;LI&gt;      *&lt;/LI&gt;
&lt;LI&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;      User&lt;/LI&gt;
&lt;LI&gt;      *&lt;/LI&gt;
&lt;LI&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;LI&gt;      id&lt;/LI&gt;
&lt;LI&gt;      *&lt;/LI&gt;
&lt;LI&gt;&lt;BR /&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;My query is:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;          index=xxxx Service=$serviceToken$ User=$userToken$ Id=$idToken$&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;When I make the query I get only thee first row of the log.&lt;BR /&gt;
I understood that it is related to fields not present in the log file.&lt;/P&gt;

&lt;P&gt;How can I modify my dashboard/query to obtain alle the rows?&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 08:35:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413203#M119140</guid>
      <dc:creator>gtonti</dc:creator>
      <dc:date>2018-05-21T08:35:35Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard to query optional fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413204#M119141</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xxxx Service=$serviceToken$ Id=$idToken$ OR User=$userToken$ 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 09:34:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413204#M119141</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-05-21T09:34:13Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard to query optional fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413205#M119142</link>
      <description>&lt;P&gt;Thank you for the reply.&lt;BR /&gt;
It works if I leave * in all the inputs.&lt;BR /&gt;
If I set User to ut1234 I want only two lines as response of the query (the row 1 and 3).&lt;/P&gt;

&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Mon, 21 May 2018 09:56:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413205#M119142</guid>
      <dc:creator>gtonti</dc:creator>
      <dc:date>2018-05-21T09:56:42Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard to query optional fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413206#M119143</link>
      <description>&lt;P&gt;Yes, you are right this will not work in that case. This is because you are searching &lt;CODE&gt;User=ut1234 OR Id=*&lt;/CODE&gt;&lt;BR /&gt;
In order to write correct search query, you would need to add only those fields which are available in all the events.  OR else you would need to find a workaround &lt;/P&gt;

&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=xxxx | fillnull value="NA" User |search  Service=$serviceToken$ Id=$idToken$  User=$userToken$ 
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 21 May 2018 12:05:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413206#M119143</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-05-21T12:05:40Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard to query optional fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413207#M119144</link>
      <description>&lt;P&gt;Hi everybody,&lt;BR /&gt;
 I adopted this solution. I created a token using change/condition. In this scenario I changed the default value form "*" to blanck.&lt;/P&gt;

&lt;P&gt;The input in the xml dashboard definition is:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&amp;lt;input type="text"&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;label&amp;gt;User&amp;lt;/label&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;initialValue&amp;gt;&amp;lt;/initialValue&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;change&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;condition value=""&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;set token="userToken"&amp;gt;&amp;lt;/set&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;/condition&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;condition&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;set token="userToken"&amp;gt;User=$value$&amp;lt;/set&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;/condition&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;/change&amp;gt;&lt;/LI&gt;
&lt;LI&gt;&amp;lt;/input&amp;gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;the query is:&lt;BR /&gt;
index=xxx $userToken$ &lt;/P&gt;

&lt;P&gt;what happens is:&lt;BR /&gt;
1) if User is empty/blank the query is index=xxx&lt;BR /&gt;
2) if User has a value the query is index=xxx User=value&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 10:24:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413207#M119144</guid>
      <dc:creator>gtonti</dc:creator>
      <dc:date>2018-05-22T10:24:19Z</dc:date>
    </item>
    <item>
      <title>Re: Dashboard to query optional fields</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413208#M119145</link>
      <description>&lt;P&gt;Worked for me! Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 06 Feb 2020 14:33:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Dashboard-to-query-optional-fields/m-p/413208#M119145</guid>
      <dc:creator>duartet</dc:creator>
      <dc:date>2020-02-06T14:33:59Z</dc:date>
    </item>
  </channel>
</rss>

