<?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 Populate dropdown menu using lookup and tokens with multiple field values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417137#M120045</link>
    <description>&lt;P&gt;I am trying to populate a dropdown menu using a lookup table that contains all my server's hostname in one column and their Category in another &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup UFlookups.csv  
| dedup Category
| stats count by Category host
| fields - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The query above populates the dropdown with the category names as intended but I'm only able to show one server per Category when there should be showing several.  Could this be due to my dedup?  Another thing I read was using eval tokens in the XML, if that's the preferred method, can someone help me understand how to should multiple host if my token is named Hosts?&lt;/P&gt;</description>
    <pubDate>Mon, 02 Jul 2018 04:48:39 GMT</pubDate>
    <dc:creator>johnward4</dc:creator>
    <dc:date>2018-07-02T04:48:39Z</dc:date>
    <item>
      <title>Populate dropdown menu using lookup and tokens with multiple field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417137#M120045</link>
      <description>&lt;P&gt;I am trying to populate a dropdown menu using a lookup table that contains all my server's hostname in one column and their Category in another &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup UFlookups.csv  
| dedup Category
| stats count by Category host
| fields - count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The query above populates the dropdown with the category names as intended but I'm only able to show one server per Category when there should be showing several.  Could this be due to my dedup?  Another thing I read was using eval tokens in the XML, if that's the preferred method, can someone help me understand how to should multiple host if my token is named Hosts?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 04:48:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417137#M120045</guid>
      <dc:creator>johnward4</dc:creator>
      <dc:date>2018-07-02T04:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Populate dropdown menu using lookup and tokens with multiple field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417138#M120046</link>
      <description>&lt;P&gt;@johnward4, yes the dedup deletes all the duplicate category. If you want both Category and host in the combination, then use &lt;CODE&gt;dedup Category Host&lt;/CODE&gt;.&lt;BR /&gt;
How do you want the multiple values in the token , because drop down can select only one value at a time? Are you looking for multiselect and a logical operator to connect them?&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 06:02:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417138#M120046</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-02T06:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: Populate dropdown menu using lookup and tokens with multiple field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417139#M120047</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;
you can use two connected dropdown lists , in other words, you could create a dropdown list for your Categories and then use the choise to filter the server lists, something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;input type="dropdown" token="Category"&amp;gt;
  &amp;lt;label&amp;gt;Category&amp;lt;/label&amp;gt;
  &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;
       | inputlookup UFlookups.csv  
       | dedup Category
       | sort Category
       | table Category
    &amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;$Time.earliest$&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;$Time.latest$&amp;lt;/latest&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldForLabel&amp;gt;Category&amp;lt;/fieldForLabel&amp;gt;
  &amp;lt;fieldForValue&amp;gt;Category&amp;lt;/fieldForValue&amp;gt;
  &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
  &amp;lt;prefix&amp;gt;Category="&amp;lt;/prefix&amp;gt;
  &amp;lt;suffix&amp;gt;"&amp;lt;/suffix&amp;gt;
&amp;lt;/input&amp;gt;
&amp;lt;input type="dropdown" token="server"&amp;gt;
  &amp;lt;label&amp;gt;Server&amp;lt;/label&amp;gt;
  &amp;lt;choice value="*"&amp;gt;All&amp;lt;/choice&amp;gt;
  &amp;lt;search&amp;gt;
    &amp;lt;query&amp;gt;
       | inputlookup UFlookups.csv  
       | search $Category$
       | sort host
       | table host
    &amp;lt;/query&amp;gt;
    &amp;lt;earliest&amp;gt;$Time.earliest$&amp;lt;/earliest&amp;gt;
    &amp;lt;latest&amp;gt;$Time.latest$&amp;lt;/latest&amp;gt;
  &amp;lt;/search&amp;gt;
  &amp;lt;fieldForLabel&amp;gt;host&amp;lt;/fieldForLabel&amp;gt;
  &amp;lt;fieldForValue&amp;gt;host&amp;lt;/fieldForValue&amp;gt;
  &amp;lt;default&amp;gt;*&amp;lt;/default&amp;gt;
  &amp;lt;initialValue&amp;gt;*&amp;lt;/initialValue&amp;gt;
  &amp;lt;prefix&amp;gt;host="&amp;lt;/prefix&amp;gt;
  &amp;lt;suffix&amp;gt;"&amp;lt;/suffix&amp;gt;
&amp;lt;/input&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 10:00:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417139#M120047</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2018-07-02T10:00:17Z</dc:date>
    </item>
    <item>
      <title>Re: Populate dropdown menu using lookup and tokens with multiple field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417140#M120048</link>
      <description>&lt;P&gt;@cusello, second dropdown query is better off this way:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    | inputlookup UFlookups.csv where $Category$
    | dedup host
    | sort host
    | table host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Jul 2018 10:58:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417140#M120048</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-07-02T10:58:24Z</dc:date>
    </item>
    <item>
      <title>Re: Populate dropdown menu using lookup and tokens with multiple field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417141#M120049</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup UFlookups.csv 
| stats values(host) AS host BY Category
| nomv host
| eval Category = Category . "(" . host . ")"
| table Category
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Jul 2018 12:27:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417141#M120049</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-02T12:27:42Z</dc:date>
    </item>
    <item>
      <title>Re: Populate dropdown menu using lookup and tokens with multiple field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417142#M120050</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| inputlookup UFlookups.csv 
| stats values(Category) AS Category BY host
| nomv Category
| eval host = host . "(" . Category . ")"
| table host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 02 Jul 2018 12:31:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417142#M120050</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-02T12:31:17Z</dc:date>
    </item>
    <item>
      <title>Re: Populate dropdown menu using lookup and tokens with multiple field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417143#M120051</link>
      <description>&lt;P&gt;I've been using a static method to get the desired representation so far but I'm testing using the lookup to populate the dropdown to show labels for my server "Category" field.  The lookup has a full list of my hosts in the first column and their Category in the second column.  &lt;/P&gt;

&lt;P&gt;Old method, a dropdown Static option&lt;/P&gt;

&lt;P&gt;Token : Hosts&lt;/P&gt;

&lt;P&gt;Name : "BI"   Value :  dwhprd* OR host="dwhutilprd*" OR host="dwhclient*" OR host="dwhsql*" OR host="dwhmobile*" OR host="dwhmstr*" OR host="dwhiserver*" OR host="r2wdb02" OR host="r2wapp02" OR host="r2wpub02" OR host="dwhcisrv*" OR host="dwheisrv*"`&lt;/P&gt;

&lt;P&gt;CPU Panel Query&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|multisearch
   [search index=os host=$Hosts$ sourcetype=cpu cpu="all" |eval cpu_used_percent=100-PercentIdleTime]
   [search index=perfmon host=$Hosts$ source="Perfmon:CPU" counter="% User Time"  OR counter="% Processor Time"
    |eval cpu_user_percent=if(counter=="% User Time",round(Value,2),""), cpu_load_percent=if(counter=="% Processor Time",round(Value),""), cpu_used_percent=user_cpu+proc_cpu]
|eval lhost=upper(host)
|bin _time span=10m
|stats avg(cpu_user_percent) as user_cpu, avg(cpu_load_percent) as proc_cpu by host, _time
|stats last(user_cpu) as user_cpu, last(proc_cpu) as proc_cpu, sparkline(avg(user_cpu)) as "% User CPU Load", sparkline(avg(proc_cpu)) as "% Processor CPU Load" by host
|eval  user_cpu=round(user_cpu,2), proc_cpu=round(proc_cpu,2)
|rename user_cpu as "% Current User CPU Load", proc_cpu as "% Current Processor Load"
| sort - "% Current User CPU Load"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 29 Sep 2020 20:15:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417143#M120051</guid>
      <dc:creator>johnward4</dc:creator>
      <dc:date>2020-09-29T20:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Populate dropdown menu using lookup and tokens with multiple field values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417144#M120052</link>
      <description>&lt;P&gt;I'm getting the following error in my dashboard panels&lt;/P&gt;

&lt;P&gt;Error in 'search' command. Unable to parase the search: Comparator '=' has an invalid term on the left hand side: host=host&lt;/P&gt;</description>
      <pubDate>Mon, 02 Jul 2018 19:19:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Populate-dropdown-menu-using-lookup-and-tokens-with-multiple/m-p/417144#M120052</guid>
      <dc:creator>johnward4</dc:creator>
      <dc:date>2018-07-02T19:19:07Z</dc:date>
    </item>
  </channel>
</rss>

