<?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 How do I edit my search to find the monthly average to compare against daily totals? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-monthly-average-to-compare/m-p/284148#M85893</link>
    <description>&lt;P&gt;So I have the following search/report that I run daily:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_linux NOT root tag=authentication NOT tag=failure | stats count by host, user, eventtype, src_ip | search eventtype=*authentication* | eval dest_count=host+":"+src_ip+"("+count+")" | stats values(dest_count) AS Daily by user, eventtype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which generates output similar to the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user        eventtype               Daily
----        ---------               -----
user1   sshd_authentication  system5.xyz.com:192.168.1.2(1)
user2    sshd_authentication     system12.xyz.com:192.168.1.42(2)
                                 system24.xyz.com:192.168.1.29(12)
user3   sshd_authentication  system15.xyz.com:192.168.1.24(7)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to modify this to add a column to give me the 30-day average for each user on the respective system. A sample output would be (or something similar):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    user        eventtype               Daily                          Avg
    ----        ---------               -----                         -----
    user1   sshd_authentication  system5.xyz.com:192.168.1.2(1)      5
    user2    sshd_authentication     system12.xyz.com:192.168.1.42(2)    3
                                     system24.xyz.com:192.168.1.29(42)   1
    user3   sshd_authentication  system15.xyz.com:192.168.1.24(7)    7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm having trouble getting this to work. Can anyone offer any suggestions on what the best way would be to accomplish this? Thank you.&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jun 2016 12:14:40 GMT</pubDate>
    <dc:creator>user12345a_2</dc:creator>
    <dc:date>2016-06-08T12:14:40Z</dc:date>
    <item>
      <title>How do I edit my search to find the monthly average to compare against daily totals?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-monthly-average-to-compare/m-p/284148#M85893</link>
      <description>&lt;P&gt;So I have the following search/report that I run daily:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_linux NOT root tag=authentication NOT tag=failure | stats count by host, user, eventtype, src_ip | search eventtype=*authentication* | eval dest_count=host+":"+src_ip+"("+count+")" | stats values(dest_count) AS Daily by user, eventtype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;which generates output similar to the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;user        eventtype               Daily
----        ---------               -----
user1   sshd_authentication  system5.xyz.com:192.168.1.2(1)
user2    sshd_authentication     system12.xyz.com:192.168.1.42(2)
                                 system24.xyz.com:192.168.1.29(12)
user3   sshd_authentication  system15.xyz.com:192.168.1.24(7)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want to modify this to add a column to give me the 30-day average for each user on the respective system. A sample output would be (or something similar):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    user        eventtype               Daily                          Avg
    ----        ---------               -----                         -----
    user1   sshd_authentication  system5.xyz.com:192.168.1.2(1)      5
    user2    sshd_authentication     system12.xyz.com:192.168.1.42(2)    3
                                     system24.xyz.com:192.168.1.29(42)   1
    user3   sshd_authentication  system15.xyz.com:192.168.1.24(7)    7
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm having trouble getting this to work. Can anyone offer any suggestions on what the best way would be to accomplish this? Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jun 2016 12:14:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-monthly-average-to-compare/m-p/284148#M85893</guid>
      <dc:creator>user12345a_2</dc:creator>
      <dc:date>2016-06-08T12:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: How do I edit my search to find the monthly average to compare against daily totals?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-monthly-average-to-compare/m-p/284149#M85894</link>
      <description>&lt;P&gt;This one is a little tricky because you need to search a month of data in order to get the average, but still process daily results as well.  Here was my stab at it, searching over the "Last 30 Days":&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=os_linux NOT root tag=authentication NOT tag=failure 
| bucket _time span=1d 
| stats count(eval(_time=relative_time(now(),"@d"))) as count, count as total by host, user, eventtype, src_ip 
| search eventtype=*authentication*
| eval dest_count=host+":"+src_ip+"("+count+")", average=total/30
| stats values(dest_count) as Daily, values(average) as Average by user, eventtype
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;By bucketing the _time in 1 day increments, we can grab just the count of today's events and the total count.  Will this do the trick for you?&lt;/P&gt;</description>
      <pubDate>Thu, 09 Jun 2016 01:01:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-edit-my-search-to-find-the-monthly-average-to-compare/m-p/284149#M85894</guid>
      <dc:creator>justinatpnnl</dc:creator>
      <dc:date>2016-06-09T01:01:19Z</dc:date>
    </item>
  </channel>
</rss>

