<?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: Timechart aggregation with 2 fields for a count over time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252229#M189332</link>
    <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;metricName="fooMetric" | bin span=1d _time | stats sum(fooCount) as sCount by _time fooKey fooLoc | WHERE sCount &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Sat, 27 Aug 2016 16:32:49 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-08-27T16:32:49Z</dc:date>
    <item>
      <title>Timechart aggregation with 2 fields for a count over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252228#M189331</link>
      <description>&lt;P&gt;I have events of this form:&lt;/P&gt;

&lt;P&gt;fooKey="abc", fooLoc="5", fooCount="1"&lt;BR /&gt;
fooKey="def", fooLoc="10", fooCount="1"&lt;BR /&gt;
fooKey="abc", fooLoc="5", fooCount="1"&lt;BR /&gt;
fooKey="ghi", fooLoc="15", fooCount="2"&lt;BR /&gt;
fooKey="ghi", fooLoc="15", fooCount="3"&lt;/P&gt;

&lt;P&gt;I want to get back a timechart with 1-day spans to display counts totals for each unique fooKey and fooLoc combination; i.e. to aggregate into&lt;/P&gt;

&lt;P&gt;fooKey:"abc", fooLoc: "5" =&amp;gt; count 2&lt;BR /&gt;
fooKey:"def", fooLoc:"10" =&amp;gt; count 1&lt;BR /&gt;
fooKey:"ghi", fooLoc:"15" =&amp;gt; count 5&lt;/P&gt;

&lt;P&gt;And filter out and don't show the ones where the count is not greater than 1.  So far, I have this, but it is not working correctly (when I try to add the where clause):&lt;/P&gt;

&lt;P&gt;metricName="fooMetric" | eval fooKeyLoc=fooKey + "#" + fooLoc | timechart span=1d sum(fooCount) as sCount by fooKeyLoc WHERE sCount &amp;gt; 1&lt;/P&gt;

&lt;P&gt;I concatenated the 2 fields with the hash, as timechart doesn't allow grouping by more than 1 field.&lt;/P&gt;

&lt;P&gt;Many thanks in advance.&lt;/P&gt;</description>
      <pubDate>Sat, 27 Aug 2016 00:16:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252228#M189331</guid>
      <dc:creator>seanawilliams</dc:creator>
      <dc:date>2016-08-27T00:16:34Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart aggregation with 2 fields for a count over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252229#M189332</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;metricName="fooMetric" | bin span=1d _time | stats sum(fooCount) as sCount by _time fooKey fooLoc | WHERE sCount &amp;gt; 1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Aug 2016 16:32:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252229#M189332</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-08-27T16:32:49Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart aggregation with 2 fields for a count over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252230#M189333</link>
      <description>&lt;P&gt;I never have been able to get the WHERE clause of the timechart command to work as I would expect.  My workaround is to use the stats command to narrow my results, which I then pipe to a timechart.  For yours it would look something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;metricName="fooMetric" | eval fooKeyLoc=fooKey + "#" + fooLoc 
| bucket _time span=1d | stats sum(fooCount) as sCount by _time, fooKeyLoc | search sCount &amp;gt; 1 
| timechart span=1d sum(sCount) as sCount by fooKeyLoc
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 27 Aug 2016 17:05:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252230#M189333</guid>
      <dc:creator>justinatpnnl</dc:creator>
      <dc:date>2016-08-27T17:05:31Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart aggregation with 2 fields for a count over time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252231#M189334</link>
      <description>&lt;P&gt;Thanks.  Looks like this nails it!&lt;/P&gt;</description>
      <pubDate>Sun, 28 Aug 2016 00:25:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Timechart-aggregation-with-2-fields-for-a-count-over-time/m-p/252231#M189334</guid>
      <dc:creator>seanawilliams</dc:creator>
      <dc:date>2016-08-28T00:25:39Z</dc:date>
    </item>
  </channel>
</rss>

