<?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: Logging number of events based on log file in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62596#M15455</link>
    <description>&lt;P&gt;The log does not have just "email sent to" lines....it has all other info as well which I've not printed here&lt;/P&gt;</description>
    <pubDate>Tue, 18 Sep 2012 00:54:23 GMT</pubDate>
    <dc:creator>freephoneid</dc:creator>
    <dc:date>2012-09-18T00:54:23Z</dc:date>
    <item>
      <title>Logging number of events based on log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62593#M15452</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;My log snippet is shown below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[2012-09-01 11:02:27:405 GMT+00:00][Timer-1][com.abc.myprog] INFO email sent to agaur12@hotmail.com (firstName: null, lastName: null, language: eng, expiryDate: 2012-09-02 08:12:16.0)
[2012-09-01 11:02:32:544 GMT+00:00][Timer-1][com.abc.myprog] INFO email sent to testmyyyynp@test.com (firstName: null, lastName: null, language: eng, expiryDate: 2012-09-02 03:29:42.0)
[2012-09-02 11:02:37:679 GMT+00:00][Timer-1][com.abc.myprog] INFO email sent to auuuu@abcd.com (firstName: jaber, lastName: kapo, language: eng, expiryDate: 2012-09-02 10:50:46.0)
[2012-09-03 11:02:42:806 GMT+00:00][Timer-1][com.abc.myprog] INFO email sent to test_123iopm@test.com (firstName: null, lastName: null, language: eng, expiryDate: 2012-09-02 21:39:43.0)
[2012-09-03 11:02:27:405 GMT+00:00][Timer-1][com.abc.myprog] INFO email sent to ggg@test.com (firstName: null, lastName: null, language: eng, expiryDate: 2012-09-02 08:12:16.0)
[2012-09-03 11:02:22:400 GMT+00:00][Timer-1][com.abc.myprog] INFO email sent to nfmd@yahoo.com (firstName: null, lastName: null, language: eng, expiryDate: 2012-09-02 08:12:16.0)
[2012-09-05 11:02:32:544 GMT+00:00][Timer-1][com.abc.myprog] INFO email sent to testmnp@test.com (firstName: null, lastName: null, language: eng, expiryDate: 2012-09-02 03:29:42.0)
[2012-09-05 11:02:37:679 GMT+00:00][Timer-1][com.abc.myprog] INFO email sent to nnjj@abc.com (firstName: jack, lastName: dorson, language: eng, expiryDate: 2012-09-02 10:50:46.0)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Query should return data on how many emails were sent on a particular day i.e. if I want to know how many emails were sent on 2012-09-04, it should return 0 records.&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Query should print the data in below format mentioning the number of emails sent for all the days in the log:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Date        No of Emails Sent
2012-09-01  2
2012-09-02  1
2012-09-03  3
2012-09-04  0
2012-09-05  2
&lt;/CODE&gt;&lt;/PRE&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;I'll appreciate if some one can provide answers to the above 2 questions.&lt;/P&gt;

&lt;P&gt;Thanks in Advance!!&lt;/P&gt;

&lt;P&gt;UPDATE: The log has other entries as well. I've provided only snippet. &lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2012 00:41:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62593#M15452</guid>
      <dc:creator>freephoneid</dc:creator>
      <dc:date>2012-09-18T00:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Logging number of events based on log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62594#M15453</link>
      <description>&lt;P&gt;perhaps you can look at the &lt;CODE&gt;timechart&lt;/CODE&gt; search command.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2012 00:48:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62594#M15453</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2012-09-18T00:48:07Z</dc:date>
    </item>
    <item>
      <title>Re: Logging number of events based on log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62595#M15454</link>
      <description>&lt;P&gt;So for the first one, you simply need to do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=FOO | stats count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;and restrict the time range to a single day.&lt;/P&gt;

&lt;P&gt;For the second, you can use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=FOO | timechart span=1d count
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which will make sure you get the zero values on days with no events.  You can rename columns using &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;count as "No of emails" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;or something similar.&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2012 00:49:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62595#M15454</guid>
      <dc:creator>emiller42</dc:creator>
      <dc:date>2012-09-18T00:49:46Z</dc:date>
    </item>
    <item>
      <title>Re: Logging number of events based on log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62596#M15455</link>
      <description>&lt;P&gt;The log does not have just "email sent to" lines....it has all other info as well which I've not printed here&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2012 00:54:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62596#M15455</guid>
      <dc:creator>freephoneid</dc:creator>
      <dc:date>2012-09-18T00:54:23Z</dc:date>
    </item>
    <item>
      <title>Re: Logging number of events based on log file</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62597#M15456</link>
      <description>&lt;P&gt;then you would need to filter down to just the 'email sent to' events before the pipe to stats/timechart using something like:&lt;/P&gt;

&lt;P&gt;sourcetype=FOO "email sent to" | ...&lt;/P&gt;</description>
      <pubDate>Tue, 18 Sep 2012 01:00:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Logging-number-of-events-based-on-log-file/m-p/62597#M15456</guid>
      <dc:creator>emiller42</dc:creator>
      <dc:date>2012-09-18T01:00:50Z</dc:date>
    </item>
  </channel>
</rss>

