<?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: Use of Count by Date in |metadata type=hosts in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155189#M43648</link>
    <description>&lt;P&gt;All events have the _time field automatically added by Splunk.  You can use that to generate your reports.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Dec 2014 18:37:54 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2014-12-09T18:37:54Z</dc:date>
    <item>
      <title>Use of Count by Date in |metadata type=hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155188#M43647</link>
      <description>&lt;P&gt;Hello. I would like to know if there is any speicific  - convenient - way to perform stats count by various date.&lt;/P&gt;

&lt;P&gt;Using |metadata type=hosts |fields host totalCount, I get something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;host               totalCount
    A                    5
    B                    27
    C                    48
    D                    95
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to perform stats count by name over a period of time by date&lt;/P&gt;

&lt;P&gt;but the problem is that the log does not come with the timestamp. &lt;/P&gt;

&lt;P&gt;As a result, I've been manually performing &lt;BR /&gt;
|metadata type=hosts |fields host totalCount| stats count by Name     Set the timestamp to earliest=-2d@d latest -d@d&lt;BR /&gt;
|metadata type=hosts |fields host totalCount| stats count by Name     Set the timestamp to earliest=-3d@d latest -2@d&lt;BR /&gt;
|metadata type=hosts |fields host totalCount| stats count by Name     Set the timestamp to earliest=-4d@d latest -3@d&lt;BR /&gt;
   ...             ...              ... &lt;BR /&gt;
and so on.&lt;/P&gt;

&lt;P&gt;Is this the only way or is there any easier way to run the query to collect all the counts for date to get something like this;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  host      12/04/14      12/05/14      12/06/14      ...
    A         5           10              ...
    B         27          12              ...
    C         48          40              ...
    D         95          25              ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks in advance!&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2014 18:14:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155188#M43647</guid>
      <dc:creator>hcheang</dc:creator>
      <dc:date>2014-12-09T18:14:37Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Count by Date in |metadata type=hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155189#M43648</link>
      <description>&lt;P&gt;All events have the _time field automatically added by Splunk.  You can use that to generate your reports.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2014 18:37:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155189#M43648</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2014-12-09T18:37:54Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Count by Date in |metadata type=hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155190#M43649</link>
      <description>&lt;P&gt;It's in metadata format in fact.&lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;|metadata type=hosts&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;And no, I 've tried |metadata type=hosts|stats count by _time &lt;/P&gt;

&lt;P&gt;and it gives nothing.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Dec 2014 18:52:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155190#M43649</guid>
      <dc:creator>hcheang</dc:creator>
      <dc:date>2014-12-09T18:52:58Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Count by Date in |metadata type=hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155191#M43650</link>
      <description>&lt;P&gt;The metadata command doesn't contains the time field for when the report was generated. Try this workaround:- &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| metasearch index=* | eval Date=strftime(_time,"%Y-%m-%d") | chart count over host by Date
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Dec 2014 22:15:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155191#M43650</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-12-09T22:15:48Z</dc:date>
    </item>
    <item>
      <title>Re: Use of Count by Date in |metadata type=hosts</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155192#M43651</link>
      <description>&lt;P&gt;The chart it is generating is exactly what I want but the problem is that it is giving the wrong count.&lt;/P&gt;

&lt;P&gt;Moreover, after 2 days count (as of Today, 2014-12-10, 2014-12-11), all I'm getting is 0 for the count which isn't true.&lt;/P&gt;

&lt;P&gt;Any suggestion?&lt;/P&gt;</description>
      <pubDate>Thu, 11 Dec 2014 17:21:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Use-of-Count-by-Date-in-metadata-type-hosts/m-p/155192#M43651</guid>
      <dc:creator>hcheang</dc:creator>
      <dc:date>2014-12-11T17:21:05Z</dc:date>
    </item>
  </channel>
</rss>

