<?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 write an eval if/then statement to produce a result for a single value visualization? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-an-eval-if-then-statement-to-produce-a-result-for-a/m-p/275950#M83247</link>
    <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;

&lt;P&gt;Longtime user of Splunk and come here often to find my answers, but I can't exactly solve the issue I have here.&lt;/P&gt;

&lt;P&gt;Background of what I'm trying to do:&lt;/P&gt;

&lt;P&gt;My Dashboard has options for PROD, DEMO. When I select the dropdown, it will change the searches from my production servers to my demo servers. I'm looking at java logging to look at max threads on our tomcat hosts and would like to look at demo logging, but the hard part is, it's a different number for all hosts.&lt;/P&gt;

&lt;P&gt;Here is my XML:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=$il_env$-ilas* sourcetype=jmx attributevalue="*" attributeID=366 | stats latest(attributevalue) | rangemap field=latest(attributevalue) low=0-2500 elevated=2500-2750 severe=2750-3000 default=none
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My goal is to use the &lt;CODE&gt;$il_env$&lt;/CODE&gt; wildcard to do an if/then statement. If &lt;CODE&gt;host=production&lt;/CODE&gt;, the search will use &lt;CODE&gt;attributeID=366&lt;/CODE&gt;. If the &lt;CODE&gt;host=demo&lt;/CODE&gt;, the search will use &lt;CODE&gt;attributeID=912&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated. &lt;/P&gt;</description>
    <pubDate>Tue, 13 Sep 2016 16:41:08 GMT</pubDate>
    <dc:creator>jnichols914</dc:creator>
    <dc:date>2016-09-13T16:41:08Z</dc:date>
    <item>
      <title>How to write an eval if/then statement to produce a result for a single value visualization?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-an-eval-if-then-statement-to-produce-a-result-for-a/m-p/275950#M83247</link>
      <description>&lt;P&gt;Hi Everyone,&lt;/P&gt;

&lt;P&gt;Longtime user of Splunk and come here often to find my answers, but I can't exactly solve the issue I have here.&lt;/P&gt;

&lt;P&gt;Background of what I'm trying to do:&lt;/P&gt;

&lt;P&gt;My Dashboard has options for PROD, DEMO. When I select the dropdown, it will change the searches from my production servers to my demo servers. I'm looking at java logging to look at max threads on our tomcat hosts and would like to look at demo logging, but the hard part is, it's a different number for all hosts.&lt;/P&gt;

&lt;P&gt;Here is my XML:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host=$il_env$-ilas* sourcetype=jmx attributevalue="*" attributeID=366 | stats latest(attributevalue) | rangemap field=latest(attributevalue) low=0-2500 elevated=2500-2750 severe=2750-3000 default=none
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My goal is to use the &lt;CODE&gt;$il_env$&lt;/CODE&gt; wildcard to do an if/then statement. If &lt;CODE&gt;host=production&lt;/CODE&gt;, the search will use &lt;CODE&gt;attributeID=366&lt;/CODE&gt;. If the &lt;CODE&gt;host=demo&lt;/CODE&gt;, the search will use &lt;CODE&gt;attributeID=912&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;Any help would be greatly appreciated. &lt;/P&gt;</description>
      <pubDate>Tue, 13 Sep 2016 16:41:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-an-eval-if-then-statement-to-produce-a-result-for-a/m-p/275950#M83247</guid>
      <dc:creator>jnichols914</dc:creator>
      <dc:date>2016-09-13T16:41:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to write an eval if/then statement to produce a result for a single value visualization?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-write-an-eval-if-then-statement-to-produce-a-result-for-a/m-p/275951#M83248</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;form&amp;gt;
&amp;lt;input type="dropdown" token="il_env"&amp;gt;
&amp;lt;options&amp;gt;
...
&amp;lt;change&amp;gt;
&amp;lt;eval token="attr"&amp;gt;if($value$="Prod", 366, 912)&amp;lt;/eval&amp;gt;
&amp;lt;/change&amp;gt;

&amp;lt;panel&amp;gt;
&amp;lt;chart&amp;gt;
&amp;lt;search&amp;gt;
&amp;lt;query&amp;gt;host=$il_env$-ilas* sourcetype=jmx attributevalue="*" attributeID=$attr$ | stats latest(attributevalue) | rangemap field=latest(attributevalue) low=0-2500 elevated=2500-2750 severe=2750-3000 default=none&amp;lt;/query&amp;gt;
&amp;lt;/search&amp;gt;
&amp;lt;/panel&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Sep 2016 19:10:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-write-an-eval-if-then-statement-to-produce-a-result-for-a/m-p/275951#M83248</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-09-13T19:10:11Z</dc:date>
    </item>
  </channel>
</rss>

