<?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: help on eval in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444377#M168326</link>
    <description>&lt;P&gt;Hello i have an issue &lt;BR /&gt;
&lt;A href="https://www.cjoint.com/c/HGqh71VI8M0"&gt;https://www.cjoint.com/c/HGqh71VI8M0&lt;/A&gt; &lt;BR /&gt;
could you help me please?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="windows-wmi" sourcetype="WMI:CPUload"  host="$field1$" OR host="$field2$" (Name="mfetp/*" OR Name="mcshield/*") Name=$Service$
 | rex field=Name "^(?&amp;lt;Service&amp;gt;[^\/]+)[\/]" 
 | eval key=Service."-".host 
 | timechart span=10m avg(eval(if(host=="$field1$", PercentProcessorTime, null()))) AS PercentProcessorTime_AVG1
                    avg(eval(if(host=="$field2$", PercentProcessorTime, null()))) AS PercentProcessorTime_AVG2 BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Mon, 16 Jul 2018 08:05:34 GMT</pubDate>
    <dc:creator>jip31</dc:creator>
    <dc:date>2018-07-16T08:05:34Z</dc:date>
    <item>
      <title>help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444374#M168323</link>
      <description>&lt;P&gt;hello&lt;BR /&gt;
i try to use the code below but everytimes i have an issue of quote or parenthesis even if i do modifications:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=10m eval(avg(if host=="$field1$",PercentProcessorTime,NULL)) as PercentProcessorTime_AVG by host 
OR eval(avg(if host=="$field2$",PercentProcessorTime,NULL)) as PercentProcessorTime_AVG by host 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;could you help me please&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jul 2018 08:20:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444374#M168323</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2018-07-14T08:20:27Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444375#M168324</link>
      <description>&lt;P&gt;Hi @jip31,&lt;/P&gt;

&lt;P&gt;You need to enclose arguments of the if statement in a parenthesis like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=10m eval(avg(if(host=="$field1$",PercentProcessorTime,NULL))) as PercentProcessorTime_AVG by host 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Reference : &lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/7.1.1/Search/Usestatswithevalexpressionsandfunctions#Example_1:_Distinct_counts_of_matching_events"&gt;https://docs.splunk.com/Documentation/Splunk/7.1.1/Search/Usestatswithevalexpressionsandfunctions#Example_1:_Distinct_counts_of_matching_events&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/7.1.1/SearchReference/Eval#2._Use_the_if_function_to_analyze_field_values"&gt;http://docs.splunk.com/Documentation/Splunk/7.1.1/SearchReference/Eval#2._Use_the_if_function_to_analyze_field_values&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 14 Jul 2018 10:28:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444375#M168324</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-14T10:28:35Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444376#M168325</link>
      <description>&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| timechart span=10m avg(eval(if(host=="$field1$", PercentProcessorTime, null()))) AS PercentProcessorTime_AVG1
                     avg(eval(if(host=="$field2$", PercentProcessorTime, null()))) AS PercentProcessorTime_AVG2 BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 14 Jul 2018 21:39:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444376#M168325</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-14T21:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444377#M168326</link>
      <description>&lt;P&gt;Hello i have an issue &lt;BR /&gt;
&lt;A href="https://www.cjoint.com/c/HGqh71VI8M0"&gt;https://www.cjoint.com/c/HGqh71VI8M0&lt;/A&gt; &lt;BR /&gt;
could you help me please?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="windows-wmi" sourcetype="WMI:CPUload"  host="$field1$" OR host="$field2$" (Name="mfetp/*" OR Name="mcshield/*") Name=$Service$
 | rex field=Name "^(?&amp;lt;Service&amp;gt;[^\/]+)[\/]" 
 | eval key=Service."-".host 
 | timechart span=10m avg(eval(if(host=="$field1$", PercentProcessorTime, null()))) AS PercentProcessorTime_AVG1
                    avg(eval(if(host=="$field2$", PercentProcessorTime, null()))) AS PercentProcessorTime_AVG2 BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Jul 2018 08:05:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444377#M168326</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2018-07-16T08:05:34Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444378#M168327</link>
      <description>&lt;P&gt;Hi @jip31 , &lt;BR /&gt;
If you want to do a timechart based on host, you could simply do it by&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;     index="windows-wmi" sourcetype="WMI:CPUload"  host="$field1$" OR host="$field2$" (Name="mfetp/*" OR Name="mcshield/*") Name=$Service$
      | rex field=Name "^(?&amp;lt;Service&amp;gt;[^\/]+)[\/]" 
      | eval key=Service."-".host 
      | timechart span=10m avg(PercentProcessorTime) as PercentProcessorTime BY host
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 16 Jul 2018 08:26:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444378#M168327</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-16T08:26:49Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444379#M168328</link>
      <description>&lt;P&gt;Many thanks!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 08:26:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444379#M168328</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2018-07-16T08:26:50Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444380#M168329</link>
      <description>&lt;P&gt;@jip31 ,if the above answers your question, you shall accept it or vote it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 08:26:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444380#M168329</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-16T08:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444381#M168330</link>
      <description>&lt;P&gt;THANKS RENJITH&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 11:36:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444381#M168330</guid>
      <dc:creator>jip31</dc:creator>
      <dc:date>2018-07-16T11:36:52Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444382#M168331</link>
      <description>&lt;P&gt;@jip31 , again you are accepting your own answer. If one of the answer is helpful for you, please accept it or vote for it &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; .&lt;BR /&gt;
@asiddique_splunk might be able to help you!&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 12:44:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444382#M168331</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2018-07-16T12:44:32Z</dc:date>
    </item>
    <item>
      <title>Re: help on eval</title>
      <link>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444383#M168332</link>
      <description>&lt;P&gt;Did you mean to click &lt;CODE&gt;Accept&lt;/CODE&gt; here?&lt;/P&gt;</description>
      <pubDate>Mon, 16 Jul 2018 14:15:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/help-on-eval/m-p/444383#M168332</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-16T14:15:44Z</dc:date>
    </item>
  </channel>
</rss>

