<?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: sum two fileds count on linechart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152993#M42883</link>
    <description>&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="*0307.log*" trigger0=* OR trigger=*  [ search trigger0=* | head 1 | eval earliest=relative_time(lastTime,"-15d") | eval latest=_time | fields earliest, latest | format "(" "(" "" ")" "OR" ")" ] | timechart span=1h eval(count(trigger)+count(trigger0)) as triggerMain
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 28 Feb 2015 23:59:15 GMT</pubDate>
    <dc:creator>cpetterborg</dc:creator>
    <dc:date>2015-02-28T23:59:15Z</dc:date>
    <item>
      <title>sum two fileds count on linechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152988#M42878</link>
      <description>&lt;P&gt;I have two fields &lt;EM&gt;trigger0&lt;/EM&gt; and &lt;EM&gt;trigger&lt;/EM&gt; that occur several times per hour and I would like the sum (number of occurrences) of both over a one-hour timespan. I tried a lot of things from the forum but I always get "no result found".&lt;BR /&gt;
A few examples of what I've tried:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="*0307.log*" trigger0=* trigger=* [ search trigger0=* | head 1 | eval earliest=relative_time(lastTime,"-15d") | eval latest=_time | fields earliest, latest | format "(" "(" "" ")" "OR" ")"  ] | timechart span=1h sum( eval(count(trigger) + count(trigger0)) ) as totaltrigger


source="*0307.log*" trigger0=* trigger=* [ search trigger0=* | head 1 | eval earliest=relative_time(lastTime,"-15d") | eval latest=_time | fields earliest, latest | format "(" "(" "" ")" "OR" ")"  ] | timechart span=1h count(trigger) count(trigger0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It's the part after the last pipe that causes problem, I'm using the first part in other graphs.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Feb 2015 14:28:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152988#M42878</guid>
      <dc:creator>Javo222</dc:creator>
      <dc:date>2015-02-28T14:28:59Z</dc:date>
    </item>
    <item>
      <title>Re: sum two fileds count on linechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152989#M42879</link>
      <description>&lt;P&gt;Your first problem may be:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;(trigger0=* OR trigger=*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Without seeing more of what your data looks like I can't comment further on your search, but the "no result found" problem may be taken care of with using an OR between your trigger conditions if you don't have BOTH trigger0 and trigger in every event.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Again, without seeing more of what your data looks like, it is hard to tell what is wrong.&lt;/STRONG&gt;&lt;/P&gt;</description>
      <pubDate>Sat, 28 Feb 2015 15:57:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152989#M42879</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2015-02-28T15:57:14Z</dc:date>
    </item>
    <item>
      <title>Re: sum two fileds count on linechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152990#M42880</link>
      <description>&lt;P&gt;both are extracted fields and there are always present in different events.&lt;BR /&gt;
an event looks like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2015-02-22 23:59:35,255  INFO  [0.809.1.31.] .........  Start executing rule with ID 304. Triggered by a MotionDetection at 05:59:35 (Utc).
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Feb 2015 16:22:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152990#M42880</guid>
      <dc:creator>Javo222</dc:creator>
      <dc:date>2015-02-28T16:22:52Z</dc:date>
    </item>
    <item>
      <title>Re: sum two fileds count on linechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152991#M42881</link>
      <description>&lt;P&gt;Ok, I almost got it. This works:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="*0307.log*" trigger0=* OR trigger=*  [ search trigger0=* | head 1 | eval earliest=relative_time(lastTime,"-15d") | eval latest=_time | fields earliest, latest | format "(" "(" "" ")" "OR" ")" ] | timechart span=1h eval(count(trigger)) as trigger01, eval(count(trigger0)) as trigger001| eval triggerMain = trigger01+ trigger001
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But all three charts are displayed (trigger01,trigger001, triggerMain) and I would like to chart only triggerMain. I haven't managed so far&lt;/P&gt;</description>
      <pubDate>Sat, 28 Feb 2015 17:08:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152991#M42881</guid>
      <dc:creator>Javo222</dc:creator>
      <dc:date>2015-02-28T17:08:00Z</dc:date>
    </item>
    <item>
      <title>Re: sum two fileds count on linechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152992#M42882</link>
      <description>&lt;P&gt;Your search could be&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="*0307.log*" trigger0=* OR trigger=*  
    [ search trigger0=* | head 1 
     | eval earliest=relative_time(lastTime,"-15d")
     | eval latest=_time | fields earliest, latest | format "(" "(" "" ")" "OR" ")" ] 
| eval  triggerMain = trigger+ trigger0
| timechart span=1h count(triggerMain) as triggerMain
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If for some reason that doesn't work, then you could also do&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="*0307.log*" trigger0=* OR trigger=*  
    [ search trigger0=* | head 1 
     | eval earliest=relative_time(lastTime,"-15d")
     | eval latest=_time | fields earliest, latest | format "(" "(" "" ")" "OR" ")" ] 
 | timechart span=1h eval(count(trigger)) as trigger01, eval(count(trigger0)) as trigger001
 | eval triggerMain = trigger01+ trigger001
 | fields - trigger01 trigger001
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Also, I am unclear why you need all the fancy stuff for setting earliest and latest. You may get the same result by doing this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="*0307.log*" trigger0=* OR trigger=*  
| eval  triggerMain = trigger + trigger0
| timechart fixedrange=F span=1h count(triggerMain) as triggerMain
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Feb 2015 19:53:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152992#M42882</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2015-02-28T19:53:52Z</dc:date>
    </item>
    <item>
      <title>Re: sum two fileds count on linechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152993#M42883</link>
      <description>&lt;P&gt;Try:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="*0307.log*" trigger0=* OR trigger=*  [ search trigger0=* | head 1 | eval earliest=relative_time(lastTime,"-15d") | eval latest=_time | fields earliest, latest | format "(" "(" "" ")" "OR" ")" ] | timechart span=1h eval(count(trigger)+count(trigger0)) as triggerMain
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Feb 2015 23:59:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152993#M42883</guid>
      <dc:creator>cpetterborg</dc:creator>
      <dc:date>2015-02-28T23:59:15Z</dc:date>
    </item>
    <item>
      <title>Re: sum two fileds count on linechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152994#M42884</link>
      <description>&lt;P&gt;Your second solution works fine. I need the fancy stuff because I only want to see the last 15 days of event and the latest event is not always "now".&lt;/P&gt;</description>
      <pubDate>Sun, 01 Mar 2015 11:19:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152994#M42884</guid>
      <dc:creator>Javo222</dc:creator>
      <dc:date>2015-03-01T11:19:36Z</dc:date>
    </item>
    <item>
      <title>Re: sum two fileds count on linechart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152995#M42885</link>
      <description>&lt;P&gt;@Cpetterborg 's solution works fine and looks easier than lguinn&lt;/P&gt;</description>
      <pubDate>Sun, 01 Mar 2015 11:20:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/sum-two-fileds-count-on-linechart/m-p/152995#M42885</guid>
      <dc:creator>Javo222</dc:creator>
      <dc:date>2015-03-01T11:20:22Z</dc:date>
    </item>
  </channel>
</rss>

