<?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 Timechart for created/disabled users in Dashboards &amp; Visualizations</title>
    <link>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321217#M39411</link>
    <description>&lt;P&gt;Hi, I'm looking to create a timechart of Active directory users created &amp;amp; disabled, so we can have an overview of new &amp;amp; leaving employee over the time.&lt;BR /&gt;
I'm trying to do this using the index wineventlog (from the Splunk App for Windows Infrastructure). I came up with this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog earliest=-180d@d user!="*\$" user!="\$*" (EventCode=4720 OR EventCode=4725) | eval action=if(EventCode=4725,"disabled",action) | eval action=upper(action) | rename action as Action | dedup user,Action| timechart count by Action span=1mon
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've changed the query to get a table with the users and the associated action. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog earliest=-180d@d user!="*\$" user!="\$*" (EventCode=4720 OR EventCode=4725) | eval action=if(EventCode=4725,"disabled",action) | eval action=upper(action) | rename action as Action | dedup user,Action| table user,Action,_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Due to our new user process, some of them have a created event and then a disabled with some seconds/minutes between them like&lt;/P&gt;

&lt;P&gt;User          Action         Time&lt;BR /&gt;
user.name1    Disabled     2017-01-27 06:19:32&lt;BR /&gt;
user.name1    Created      2017-01-27 06:18:26&lt;BR /&gt;
user.name2    Disabled     2017-01-25 03:21:31&lt;BR /&gt;
user.name3    Disabled     2017-01-23 03:12:35&lt;BR /&gt;
user.name3    Created      2017-01-23 03:11:43&lt;BR /&gt;
user.name4    Disabled     2017-01-23 02:18:26&lt;/P&gt;

&lt;P&gt;I would like to exclude the Disabled event when a user has been created on the same day. I've tried with dedup but I couldn't make it work as it keep the first occurence (that would always be disabled)&lt;BR /&gt;
This would be the desired result:&lt;/P&gt;

&lt;P&gt;User          Action         Time&lt;BR /&gt;
user.name1    Created      2017-01-27 06:18:26&lt;BR /&gt;
user.name2    Disabled     2017-01-25 03:21:31&lt;BR /&gt;
user.name3    Created      2017-01-23 03:11:43&lt;BR /&gt;
user.name4    Disabled     2017-01-23 02:18:26&lt;/P&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
    <pubDate>Mon, 29 May 2017 14:53:44 GMT</pubDate>
    <dc:creator>jypysplunk</dc:creator>
    <dc:date>2017-05-29T14:53:44Z</dc:date>
    <item>
      <title>Timechart for created/disabled users</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321217#M39411</link>
      <description>&lt;P&gt;Hi, I'm looking to create a timechart of Active directory users created &amp;amp; disabled, so we can have an overview of new &amp;amp; leaving employee over the time.&lt;BR /&gt;
I'm trying to do this using the index wineventlog (from the Splunk App for Windows Infrastructure). I came up with this query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog earliest=-180d@d user!="*\$" user!="\$*" (EventCode=4720 OR EventCode=4725) | eval action=if(EventCode=4725,"disabled",action) | eval action=upper(action) | rename action as Action | dedup user,Action| timechart count by Action span=1mon
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I've changed the query to get a table with the users and the associated action. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog earliest=-180d@d user!="*\$" user!="\$*" (EventCode=4720 OR EventCode=4725) | eval action=if(EventCode=4725,"disabled",action) | eval action=upper(action) | rename action as Action | dedup user,Action| table user,Action,_time
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Due to our new user process, some of them have a created event and then a disabled with some seconds/minutes between them like&lt;/P&gt;

&lt;P&gt;User          Action         Time&lt;BR /&gt;
user.name1    Disabled     2017-01-27 06:19:32&lt;BR /&gt;
user.name1    Created      2017-01-27 06:18:26&lt;BR /&gt;
user.name2    Disabled     2017-01-25 03:21:31&lt;BR /&gt;
user.name3    Disabled     2017-01-23 03:12:35&lt;BR /&gt;
user.name3    Created      2017-01-23 03:11:43&lt;BR /&gt;
user.name4    Disabled     2017-01-23 02:18:26&lt;/P&gt;

&lt;P&gt;I would like to exclude the Disabled event when a user has been created on the same day. I've tried with dedup but I couldn't make it work as it keep the first occurence (that would always be disabled)&lt;BR /&gt;
This would be the desired result:&lt;/P&gt;

&lt;P&gt;User          Action         Time&lt;BR /&gt;
user.name1    Created      2017-01-27 06:18:26&lt;BR /&gt;
user.name2    Disabled     2017-01-25 03:21:31&lt;BR /&gt;
user.name3    Created      2017-01-23 03:11:43&lt;BR /&gt;
user.name4    Disabled     2017-01-23 02:18:26&lt;/P&gt;

&lt;P&gt;Thanks for your help&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2017 14:53:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321217#M39411</guid>
      <dc:creator>jypysplunk</dc:creator>
      <dc:date>2017-05-29T14:53:44Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart for created/disabled users</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321218#M39412</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|makeresults | eval raw="user.name1 Disabled 2017-01-27 06:19:32
user.name1 Created 2017-01-27 06:18:26
user.name2 Disabled 2017-01-25 03:21:31
user.name3 Disabled 2017-01-23 03:12:35
user.name3 Created 2017-01-23 03:11:43
user.name4 Disabled 2017-01-23 02:18:26"
| makemv delim="
" raw
| mvexpand raw
| rename raw AS _raw
| rex "^(?&amp;lt;User&amp;gt;\S+)\s+(?&amp;lt;Action&amp;gt;\S+)\s+(?&amp;lt;Time&amp;gt;.*)$"

| rename COMMENT AS "Everything above creates test event data; everything below is your solution"

| eval _time = strptime(Time, "%Y-%m-%d %H:%M:%S")
| sort 0 - _time
| bin _time span=1d
| eventstats count(eval(Action="Created")) AS createds BY User _time
| search Action="Created" OR createds=0
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 29 May 2017 20:15:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321218#M39412</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-29T20:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart for created/disabled users</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321219#M39413</link>
      <description>&lt;P&gt;Perfect! Thanks for your quick answer.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 10:27:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321219#M39413</guid>
      <dc:creator>jypysplunk</dc:creator>
      <dc:date>2017-05-30T10:27:39Z</dc:date>
    </item>
    <item>
      <title>Re: Timechart for created/disabled users</title>
      <link>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321220#M39414</link>
      <description>&lt;P&gt;If it worked for you, be sure to click &lt;CODE&gt;Accept&lt;/CODE&gt; on the answer to close the question.&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2017 14:53:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Dashboards-Visualizations/Timechart-for-created-disabled-users/m-p/321220#M39414</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-30T14:53:47Z</dc:date>
    </item>
  </channel>
</rss>

