<?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: Detection of repeating values over a period in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70610#M17683</link>
    <description>&lt;P&gt;Depending on how you define week you could use the following 2 searches (and maybe use cphairs method to get date_week if you want to base your searches on that):&lt;/P&gt;

&lt;P&gt;This will give you a list of offenders with the number of weeks where at least 5 violations were detected and the number of weeks your search spans you could add | where count=weeks for offenders that offended every week:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|bucket _time  span=7d |  stats count(User_name) as violations by User_name,_time | where violations&amp;gt;5 | stats count sum(violations) as violations by User_name | addinfo |eval weeks=round(((info_max_time-info_min_time)/86400) / 7,0) | fields user,count,weeks,violations
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will produce a chart:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|bucket _time  span=7d |  stats count(User_name) as violations by User_name,_time | where violations&amp;gt;5 | chart sum(violations) over _time by User_name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 21 Jun 2013 18:56:02 GMT</pubDate>
    <dc:creator>chris</dc:creator>
    <dc:date>2013-06-21T18:56:02Z</dc:date>
    <item>
      <title>Detection of repeating values over a period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70606#M17679</link>
      <description>&lt;P&gt;I have a log that contains details of policy violations committed by users and this is available for a period of few months. I would like to find users who are repeatedly committing the violations over a period of time. &lt;/P&gt;

&lt;P&gt;If I do "time chart timechart limit=10 span=1w count by User_Name useother=f usenull=f", I only get top counts of users over time and not exactly repeat offenders. &lt;/P&gt;

&lt;P&gt;Any pointers in this regard would be great.&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;

&lt;HR /&gt;

&lt;P&gt;Following are some sample logs that I created just for clarifying, actual logs have lot more fields. Nonetheless user_name, date/time, rule violation are the fields that I am interested in.&lt;/P&gt;

&lt;P&gt;21/05/2013 10:00:15 user1 violated rule1&lt;BR /&gt;
21/05/2013 08:09:15 user1 violated rule2&lt;BR /&gt;
22/05/2013 10:00:15 user1 violated rule1&lt;BR /&gt;
23/05/2013 08:09:15 user2 violated rule2&lt;BR /&gt;
28/05/2013 10:00:15 user1 violated rule5&lt;BR /&gt;
29/05/2013 08:09:15 user3 violated rule4&lt;BR /&gt;
31/05/2013 10:00:15 user1 violated rule7&lt;BR /&gt;
01/06/2013 08:09:15 user3 violated rule2&lt;BR /&gt;
02/06/2013 10:00:15 user1 violated rule8&lt;BR /&gt;
05/06/2013 08:09:15 user3 violated rule5&lt;BR /&gt;
05/06/2013 10:00:15 user1 violated rule6&lt;BR /&gt;
06/06/2013 08:09:15 user4 violated rule2&lt;BR /&gt;
06/06/2013 08:09:15 user4 violated rule5&lt;BR /&gt;
06/06/2013 08:09:15 user1 violated rule2&lt;BR /&gt;
06/07/2013 08:09:15 user4 violated rule9&lt;BR /&gt;
07/06/2013 08:09:15 user4 violated rule10&lt;/P&gt;

&lt;P&gt;In the above log user4 would qualify as one of top violators, but violations are not committed every week, whereas user1 is a repeat offender who violated rules atleast 2 times a week. I need the ability to find this pattern and then plot top repeat offenders over a period of time&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2013 18:03:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70606#M17679</guid>
      <dc:creator>anusuya_k</dc:creator>
      <dc:date>2013-06-20T18:03:05Z</dc:date>
    </item>
    <item>
      <title>Re: Detection of repeating values over a period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70607#M17680</link>
      <description>&lt;P&gt;What pattern in the log qualifies as a repeat offender? You could use | stats count by User_Name to get the count over the entire period. What do the logs look like? Do you only want to see users who violate the same policy at least twice? A little more information would be great.&lt;/P&gt;</description>
      <pubDate>Thu, 20 Jun 2013 19:54:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70607#M17680</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2013-06-20T19:54:14Z</dc:date>
    </item>
    <item>
      <title>Re: Detection of repeating values over a period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70608#M17681</link>
      <description>&lt;P&gt;stats count by User_name will give me top offenders. But I would like to find user who committed &amp;gt;5 violations every week and plot the top repeat offenders over a period of may be 3 months. &lt;/P&gt;

&lt;P&gt;I have edited the post above with some sample logs.&lt;/P&gt;</description>
      <pubDate>Fri, 21 Jun 2013 04:49:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70608#M17681</guid>
      <dc:creator>anusuya_k</dc:creator>
      <dc:date>2013-06-21T04:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: Detection of repeating values over a period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70609#M17682</link>
      <description>&lt;P&gt;There's not a built-in date_week field, but to roll your own this gives a reasonable approximation:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
eval date_week=round(((_time/86400) % 365) / 7,0)&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;
It might not start the week on Sunday, but it would divide the entries into consistent seven-day blocks, if that's sufficient.  Or if that feels hacky, you could count by date, or date_mday, whatever works.  Then you could do something like the following:&lt;BR /&gt;
&lt;PRE&gt;&lt;CODE&gt;&lt;BR /&gt;
eval date_week=round(((_time/86400) % 365) / 7,0) | eventstats count by user_name date_week | timechart span=7d avg(count) by user_name&lt;BR /&gt;
&lt;/CODE&gt;&lt;/PRE&gt;&lt;BR /&gt;
A stacked column chart is nice for visualizing this.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 14:09:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70609#M17682</guid>
      <dc:creator>cphair</dc:creator>
      <dc:date>2020-09-28T14:09:08Z</dc:date>
    </item>
    <item>
      <title>Re: Detection of repeating values over a period</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70610#M17683</link>
      <description>&lt;P&gt;Depending on how you define week you could use the following 2 searches (and maybe use cphairs method to get date_week if you want to base your searches on that):&lt;/P&gt;

&lt;P&gt;This will give you a list of offenders with the number of weeks where at least 5 violations were detected and the number of weeks your search spans you could add | where count=weeks for offenders that offended every week:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|bucket _time  span=7d |  stats count(User_name) as violations by User_name,_time | where violations&amp;gt;5 | stats count sum(violations) as violations by User_name | addinfo |eval weeks=round(((info_max_time-info_min_time)/86400) / 7,0) | fields user,count,weeks,violations
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will produce a chart:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|bucket _time  span=7d |  stats count(User_name) as violations by User_name,_time | where violations&amp;gt;5 | chart sum(violations) over _time by User_name
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 21 Jun 2013 18:56:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Detection-of-repeating-values-over-a-period/m-p/70610#M17683</guid>
      <dc:creator>chris</dc:creator>
      <dc:date>2013-06-21T18:56:02Z</dc:date>
    </item>
  </channel>
</rss>

