<?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 How to set default value of variable in serch query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-default-value-of-variable-in-serch-query/m-p/108922#M28395</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a view having bar graph with timechart command. I have two drop downs  in my view. Withe selecting different values from drop down, it will change the bar graph.&lt;/P&gt;

&lt;P&gt;following is the query :&lt;/P&gt;

&lt;P&gt;index="test" sourcetype="testalert" AlertGroup=$alertGroup$ Node=$Node$ | fields LastOccurrence, Severity, Node, Location, AlertGroup, Summary | timechart count(LastOccurrence) by Severity&lt;/P&gt;

&lt;P&gt;$alertGroup$ and $Node$ are two drop down variables. While changing drop down values,the value of these variables changes.&lt;/P&gt;

&lt;P&gt;Problem is, i want to display chart on page load and on page load the values of these two variables are null and my query is returning null value. I want to set the default value of these variables as "Any". By default all the results should show in graph.&lt;/P&gt;

&lt;P&gt;Please help, if any body knows the solution.&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;

&lt;P&gt;Geetanjali&lt;/P&gt;</description>
    <pubDate>Thu, 26 May 2011 11:03:19 GMT</pubDate>
    <dc:creator>geetanjali</dc:creator>
    <dc:date>2011-05-26T11:03:19Z</dc:date>
    <item>
      <title>How to set default value of variable in serch query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-default-value-of-variable-in-serch-query/m-p/108922#M28395</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have a view having bar graph with timechart command. I have two drop downs  in my view. Withe selecting different values from drop down, it will change the bar graph.&lt;/P&gt;

&lt;P&gt;following is the query :&lt;/P&gt;

&lt;P&gt;index="test" sourcetype="testalert" AlertGroup=$alertGroup$ Node=$Node$ | fields LastOccurrence, Severity, Node, Location, AlertGroup, Summary | timechart count(LastOccurrence) by Severity&lt;/P&gt;

&lt;P&gt;$alertGroup$ and $Node$ are two drop down variables. While changing drop down values,the value of these variables changes.&lt;/P&gt;

&lt;P&gt;Problem is, i want to display chart on page load and on page load the values of these two variables are null and my query is returning null value. I want to set the default value of these variables as "Any". By default all the results should show in graph.&lt;/P&gt;

&lt;P&gt;Please help, if any body knows the solution.&lt;/P&gt;

&lt;P&gt;Thanks in advance&lt;/P&gt;

&lt;P&gt;Geetanjali&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2011 11:03:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-default-value-of-variable-in-serch-query/m-p/108922#M28395</guid>
      <dc:creator>geetanjali</dc:creator>
      <dc:date>2011-05-26T11:03:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value of variable in serch query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-default-value-of-variable-in-serch-query/m-p/108923#M28396</link>
      <description>&lt;P&gt;geetanjali,&lt;/P&gt;

&lt;P&gt;Assuming you are using Advanced XML StaticSelect or SearchSelect Lister modules with ConvertToIntention, you can add an "Any" option like so (basically the value for the "Any" options is &lt;CODE&gt;"*"&lt;/CODE&gt;; If you still want to see events that don't have an AlertGroup field you would need to add a &lt;CODE&gt;"| fillnull"&lt;/CODE&gt; to your search):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;module name="StaticSelect"&amp;gt;
  &amp;lt;param name="settingToCreate"&amp;gt;alertGroup_setting&amp;lt;/param&amp;gt;
  &amp;lt;param name="label"&amp;gt;Alert Group: &amp;lt;/param&amp;gt;
  &amp;lt;param name="searchWhenChanged"&amp;gt;True&amp;lt;/param&amp;gt;
  &amp;lt;param name="staticFieldsToDisplay"&amp;gt;
    &amp;lt;list&amp;gt;
      &amp;lt;param name="label"&amp;gt;Any&amp;lt;/param&amp;gt;
      &amp;lt;param name="value"&amp;gt;*&amp;lt;/param&amp;gt;
    &amp;lt;/list&amp;gt;
    ...
  &amp;lt;/param&amp;gt;
  &amp;lt;module name="ConvertToIntention"&amp;gt;
    &amp;lt;param name="settingToConvert"&amp;gt;alertGroup_setting&amp;lt;/param&amp;gt;
    &amp;lt;param name="intention"&amp;gt;
      &amp;lt;param name="name"&amp;gt;stringreplace&amp;lt;/param&amp;gt;
      &amp;lt;param name="arg"&amp;gt;
        &amp;lt;param name="alertGroup"&amp;gt;
          &amp;lt;param name="value"&amp;gt;$target$&amp;lt;/param&amp;gt;
        &amp;lt;/param&amp;gt;
      &amp;lt;/param&amp;gt;
    &amp;lt;/param&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 May 2011 16:28:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-default-value-of-variable-in-serch-query/m-p/108923#M28396</guid>
      <dc:creator>hazekamp</dc:creator>
      <dc:date>2011-05-26T16:28:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to set default value of variable in serch query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-set-default-value-of-variable-in-serch-query/m-p/108924#M28397</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
thanks for the suggestions. I have implemented this query. But it is giving zero result.&lt;BR /&gt;
index="tougou" sourcetype="alert" AlertGroup=$alertGroup$ Node=$Node$ | fields LastOccurrence, Severity, Node, Location, AlertGroup, Summary | timechart count(LastOccurrence) by Severity | fillnull value="Any"&lt;/P&gt;

&lt;P&gt;Correct me where i m wrong.&lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2011 05:17:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-set-default-value-of-variable-in-serch-query/m-p/108924#M28397</guid>
      <dc:creator>geetanjali</dc:creator>
      <dc:date>2011-05-27T05:17:22Z</dc:date>
    </item>
  </channel>
</rss>

