<?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: Need to filter search to match src_user and time from one eventcode in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502350#M139832</link>
    <description>&lt;P&gt;Hi lgrachek,&lt;BR /&gt;
if you're sure that in your data you have less that 50,000 events with EventCode="4738" Password_Last_Set="", you can use a subsearch to filter events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog (EventCode=4724 status=success) NOT [ search index=wineventlog EventCode=4738 Password_Last_Set="&amp;lt;never&amp;gt;") | fields user ] 
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If instead you're not sure of this, you can use a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog (EventCode=4724 status=success) OR (EventCode=4738 Password_Last_Set="&amp;lt;never&amp;gt;")   
| regex src_user="(\b\d{5}ss\b)|([N]\d{6}ss)|(\b\d{5})|([N]\d{6})"  
| stats  dc(EventCode) AS count values(EventCode) As EventCode by src_user  
| where count=1 AND EventCode=4724
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Choose between user and src_user for your BY clause.&lt;/P&gt;

&lt;P&gt;Beware that in a stats commad you cannot have the same field in count and BY clause and that there's an extra char at the end of the rex command.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Wed, 30 Sep 2020 02:33:28 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-09-30T02:33:28Z</dc:date>
    <item>
      <title>Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502349#M139831</link>
      <description>&lt;P&gt;below is what I have so far. What I need to do is match the src_user from event code 4724 and the time to events in 4738 that have the same src_user and time. And show the events in 4724 that do not have a match in event code 4738 &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="wineventlog" (EventCode="4724" status=success) OR (EventCode="4738" Password_Last_Set="&amp;lt;never&amp;gt;")   | regex src_user="(\b\d{5}ss\b)|([N]\d{6}ss)|(\b\d{5})|([N]\d{6})"v  | stats  count(src_user) AS count values(src_user) by src_user,user  | where
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:33:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502349#M139831</guid>
      <dc:creator>lgrachek</dc:creator>
      <dc:date>2020-09-30T02:33:16Z</dc:date>
    </item>
    <item>
      <title>Re: Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502350#M139832</link>
      <description>&lt;P&gt;Hi lgrachek,&lt;BR /&gt;
if you're sure that in your data you have less that 50,000 events with EventCode="4738" Password_Last_Set="", you can use a subsearch to filter events:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog (EventCode=4724 status=success) NOT [ search index=wineventlog EventCode=4738 Password_Last_Set="&amp;lt;never&amp;gt;") | fields user ] 
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If instead you're not sure of this, you can use a search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=wineventlog (EventCode=4724 status=success) OR (EventCode=4738 Password_Last_Set="&amp;lt;never&amp;gt;")   
| regex src_user="(\b\d{5}ss\b)|([N]\d{6}ss)|(\b\d{5})|([N]\d{6})"  
| stats  dc(EventCode) AS count values(EventCode) As EventCode by src_user  
| where count=1 AND EventCode=4724
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Choose between user and src_user for your BY clause.&lt;/P&gt;

&lt;P&gt;Beware that in a stats commad you cannot have the same field in count and BY clause and that there's an extra char at the end of the rex command.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 02:33:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502350#M139832</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-09-30T02:33:28Z</dc:date>
    </item>
    <item>
      <title>Re: Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502351#M139833</link>
      <description>&lt;P&gt;That last one works good but that one issue that I'm running into is that the src_user has 3 events in 4724 and one in 4738 at the same time as one of the event in 4724. I need to be able to see the other 2 events that are in 4724 with different times. Is that something that can be done? &lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 13:56:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502351#M139833</guid>
      <dc:creator>lgrachek</dc:creator>
      <dc:date>2019-10-16T13:56:33Z</dc:date>
    </item>
    <item>
      <title>Re: Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502352#M139834</link>
      <description>&lt;P&gt;Hi lgrachek,&lt;BR /&gt;
let me understand, you have&lt;BR /&gt;
with 4724: user1 user2 user3&lt;BR /&gt;
with 4738: user2&lt;BR /&gt;
result: user1 user3&lt;BR /&gt;
Is it correct?&lt;BR /&gt;
If this is your need, both my searches solve this problem.&lt;/P&gt;

&lt;P&gt;I don't undestand what do you wait for results: the users or the events?&lt;BR /&gt;
if the users you already have the answer,&lt;BR /&gt;
if the events, you have to change the stats command&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats values(_raw) AS _raw dc(EventCode) AS count values(EventCode) As EventCode by src_user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What do you mean with to see the other 2 events that are in 4724 with different times&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 14:31:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502352#M139834</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-16T14:31:49Z</dc:date>
    </item>
    <item>
      <title>Re: Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502353#M139835</link>
      <description>&lt;P&gt;Ok so what I need to show is the users that are in 4724 and not in 4738 &lt;BR /&gt;
with 4724: user1(time 1:00) user2(time 2:00) user3(time 3:00) user1(time 4:00) user3(time 5:00) &lt;BR /&gt;
with 4738: user2(time 2:00) user1(time 4:00)&lt;BR /&gt;
result: user1(time 1:00) user3(time 3:00) user4(time 5:00)&lt;/P&gt;

&lt;P&gt;I need to see the user that is in 4724 that are not in 4738 at the same time as the event in 4724.&lt;BR /&gt;
If a user has an event in both 4724 and 4738 they are going to be the same time. Windows AD is going to generate the events at the same time when the user hits ok in the AD console. &lt;/P&gt;

&lt;P&gt;does that help?&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 15:10:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502353#M139835</guid>
      <dc:creator>lgrachek</dc:creator>
      <dc:date>2019-10-16T15:10:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502354#M139836</link>
      <description>&lt;P&gt;Hi lgrachek,&lt;BR /&gt;
Ok, try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats earliest(_time) AS _time dc(EventCode) AS count values(EventCode) As EventCode by src_user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 15:45:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502354#M139836</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-16T15:45:05Z</dc:date>
    </item>
    <item>
      <title>Re: Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502355#M139837</link>
      <description>&lt;P&gt;I tried the one you just sent and I'm still not getting the blow events. I need to see the other two events that have different times but remove the 4724 and 4738 that have the same user 35204sa and the same time. &lt;/P&gt;

&lt;P&gt;10/15/2019 11:46:25 AM&lt;BR /&gt;
LogName=Security&lt;BR /&gt;
SourceName=Microsoft Windows security auditing.&lt;BR /&gt;
EventCode=4724&lt;BR /&gt;
EventType=0&lt;BR /&gt;
Type=Information&lt;BR /&gt;
ComputerName=&lt;BR /&gt;
TaskCategory=User Account Management&lt;BR /&gt;
OpCode=Info&lt;BR /&gt;
RecordNumber=703879269&lt;BR /&gt;
Keywords=Audit Success&lt;BR /&gt;
Message=An attempt was made to reset an account's password.&lt;/P&gt;

&lt;P&gt;Subject:&lt;BR /&gt;
    Security ID:        \35204sa&lt;BR /&gt;
    Account Name:       35204sa&lt;BR /&gt;
    Account Domain:&lt;BR /&gt;&lt;BR /&gt;
    Logon ID:       0x8F3D0D97&lt;/P&gt;

&lt;P&gt;Target Account:&lt;BR /&gt;
    Security ID:        \35204&lt;BR /&gt;
    Account Name:       35204&lt;/P&gt;

&lt;H1&gt;    Account Domain:     &lt;/H1&gt;

&lt;P&gt;10/15/2019 11:43:40 AM&lt;BR /&gt;
LogName=Security&lt;BR /&gt;
SourceName=Microsoft Windows security auditing.&lt;BR /&gt;
EventCode=4738&lt;BR /&gt;
EventType=0&lt;BR /&gt;
Type=Information&lt;BR /&gt;
ComputerName=&lt;BR /&gt;
TaskCategory=User Account Management&lt;BR /&gt;
OpCode=Info&lt;BR /&gt;
RecordNumber=703877095&lt;BR /&gt;
Keywords=Audit Success&lt;BR /&gt;
Message=A user account was changed.&lt;/P&gt;

&lt;P&gt;Subject:&lt;BR /&gt;
    Security ID:        \35204sa&lt;BR /&gt;
    Account Name:       35204sa&lt;BR /&gt;
    Account Domain:&lt;BR /&gt;&lt;BR /&gt;
    Logon ID:       0x8F2A12D8&lt;/P&gt;

&lt;P&gt;Target Account:&lt;BR /&gt;
    Security ID:        \35204&lt;BR /&gt;
    Account Name:       35204&lt;/P&gt;

&lt;H1&gt;    Account Domain:     &lt;/H1&gt;

&lt;P&gt;10/15/2019 11:43:40 AM&lt;BR /&gt;
LogName=Security&lt;BR /&gt;
SourceName=Microsoft Windows security auditing.&lt;BR /&gt;
EventCode=4724&lt;BR /&gt;
EventType=0&lt;BR /&gt;
Type=Information&lt;BR /&gt;
ComputerName=&lt;BR /&gt;
TaskCategory=User Account Management&lt;BR /&gt;
OpCode=Info&lt;BR /&gt;
RecordNumber=703877089&lt;BR /&gt;
Keywords=Audit Success&lt;BR /&gt;
Message=An attempt was made to reset an account's password.&lt;/P&gt;

&lt;P&gt;Subject:&lt;BR /&gt;
    Security ID:        \35204sa&lt;BR /&gt;
    Account Name:       35204sa&lt;BR /&gt;
    Account Domain:&lt;BR /&gt;&lt;BR /&gt;
    Logon ID:       0x8F2C27D1&lt;/P&gt;

&lt;P&gt;Target Account:&lt;BR /&gt;
    Security ID:        \35204&lt;BR /&gt;
    Account Name:       35204&lt;/P&gt;

&lt;H1&gt;    Account Domain:     &lt;/H1&gt;

&lt;P&gt;10/15/2019 10:59:40 AM&lt;BR /&gt;
LogName=Security&lt;BR /&gt;
SourceName=Microsoft Windows security auditing.&lt;BR /&gt;
EventCode=4724&lt;BR /&gt;
EventType=0&lt;BR /&gt;
Type=Information&lt;BR /&gt;
ComputerName=&lt;BR /&gt;
TaskCategory=User Account Management&lt;BR /&gt;
OpCode=Info&lt;BR /&gt;
RecordNumber=703846921&lt;BR /&gt;
Keywords=Audit Success&lt;BR /&gt;
Message=An attempt was made to reset an account's password.&lt;/P&gt;

&lt;P&gt;Subject:&lt;BR /&gt;
    Security ID:        \35204sa&lt;BR /&gt;
    Account Name:       35204sa&lt;BR /&gt;
    Account Domain:&lt;BR /&gt;&lt;BR /&gt;
    Logon ID:       0x8E1808A6&lt;/P&gt;

&lt;P&gt;Target Account:&lt;BR /&gt;
    Security ID:        \35204&lt;BR /&gt;
    Account Name:       35204&lt;BR /&gt;
    Account Domain:     &lt;/P&gt;</description>
      <pubDate>Wed, 16 Oct 2019 19:32:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502355#M139837</guid>
      <dc:creator>lgrachek</dc:creator>
      <dc:date>2019-10-16T19:32:19Z</dc:date>
    </item>
    <item>
      <title>Re: Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502356#M139838</link>
      <description>&lt;P&gt;Hi lgrachek,&lt;BR /&gt;
try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=wineventlog (EventCode=4724 status=success) OR (EventCode=4738 Password_Last_Set="&amp;lt;never&amp;gt;")   
| rex "(?ms)Target Account:.*Account Name:\s+(?&amp;lt;user&amp;gt;\w*)"
| stats  dc(EventCode) AS count values(EventCode) As EventCode by user  _time
| where count=1 AND EventCode=4724
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Thu, 17 Oct 2019 06:21:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502356#M139838</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2019-10-17T06:21:29Z</dc:date>
    </item>
    <item>
      <title>Re: Need to filter search to match src_user and time from one eventcode</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502357#M139839</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="wineventlog" (EventCode="4724" status=success) OR (EventCode="4738" Password_Last_Set="&amp;lt;never&amp;gt;") 
| regex src_user="(\b\d{5}ss\b)|([N]\d{6}ss)|(\b\d{5})|([N]\d{6})"v 
| streamstats count(eval(EventCode="4724') AS sessionID BY src_user user
| eventstats dc(EventCode) AS EventCodes BY sessionID src_user user
| where EventCodes==1
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 22 Oct 2019 08:46:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-to-filter-search-to-match-src-user-and-time-from-one/m-p/502357#M139839</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-10-22T08:46:03Z</dc:date>
    </item>
  </channel>
</rss>

