<?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 filter out events from two separate event codes with similar fields? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377279#M110681</link>
    <description>&lt;P&gt;I'm trying to determine which Windows workstations a user is currently logged in to by:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Examining logs from our Domain Controllers with Event Codes 4624 (An account was successfully logged on) and 4634 (An account was logged off)&lt;/LI&gt;
&lt;LI&gt;filtering them against that user's ID&lt;/LI&gt;
&lt;LI&gt;looking for similar Logon_ID fields from both types of events&lt;/LI&gt;
&lt;LI&gt;and then deleting those values, as well as, the remaining 4634 events.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;This technically should give me a report showing only logons by this user with no correlated logoff, but I'm unsure how to create this query.&lt;/P&gt;

&lt;P&gt;Any help would be appreciated, and if there's a better method for solving this problem, I'm open to anything. &lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 08 Feb 2019 17:02:13 GMT</pubDate>
    <dc:creator>urasplunkronbur</dc:creator>
    <dc:date>2019-02-08T17:02:13Z</dc:date>
    <item>
      <title>How do I filter out events from two separate event codes with similar fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377279#M110681</link>
      <description>&lt;P&gt;I'm trying to determine which Windows workstations a user is currently logged in to by:&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Examining logs from our Domain Controllers with Event Codes 4624 (An account was successfully logged on) and 4634 (An account was logged off)&lt;/LI&gt;
&lt;LI&gt;filtering them against that user's ID&lt;/LI&gt;
&lt;LI&gt;looking for similar Logon_ID fields from both types of events&lt;/LI&gt;
&lt;LI&gt;and then deleting those values, as well as, the remaining 4634 events.&lt;/LI&gt;
&lt;/UL&gt;

&lt;P&gt;This technically should give me a report showing only logons by this user with no correlated logoff, but I'm unsure how to create this query.&lt;/P&gt;

&lt;P&gt;Any help would be appreciated, and if there's a better method for solving this problem, I'm open to anything. &lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 17:02:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377279#M110681</guid>
      <dc:creator>urasplunkronbur</dc:creator>
      <dc:date>2019-02-08T17:02:13Z</dc:date>
    </item>
    <item>
      <title>Re: How do I filter out events from two separate event codes with similar fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377280#M110682</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YouShouldAlwaysSpecifyAnIndex AND sourcetype=AndSourcetypeToo AND (EventCode="4624" OR EventCode="4634")
| streamstats count(eval(EventCode="4634")) AS sessoinID BY Logon_ID
| stats dc(EventCode) AS numEventCodes BY Logon_ID
| where numEventCodes&amp;lt;2
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Feb 2019 17:19:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377280#M110682</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-08T17:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: How do I filter out events from two separate event codes with similar fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377281#M110683</link>
      <description>&lt;P&gt;Thank you for the response! The results look great, I'm new to Splunk and trying to learn the ropes, so help is much appreciated.&lt;/P&gt;

&lt;P&gt;Unfortunately, we are having to rebuild the heavy forwarder due to the fact that many events passed from our windows logs are being dropped. This results in not completely reliable data, so although logically your solution should work, we still sometimes have logoff events that do not have a related logon event. Is there a way, once the distinct count and where clause have executed, to filter out the remaining 4634 events?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 08 Feb 2019 19:10:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377281#M110683</guid>
      <dc:creator>urasplunkronbur</dc:creator>
      <dc:date>2019-02-08T19:10:11Z</dc:date>
    </item>
    <item>
      <title>Re: How do I filter out events from two separate event codes with similar fields?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377282#M110684</link>
      <description>&lt;P&gt;Sure, just change the last 2 lines to this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats dc(EventCode) AS numEventCodes values(EventCode) AS EventCodes BY Logon_ID
| where numEventCodes&amp;lt;2 AND EventCodes="4363"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 08 Feb 2019 19:15:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-do-I-filter-out-events-from-two-separate-event-codes-with/m-p/377282#M110684</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-02-08T19:15:49Z</dc:date>
    </item>
  </channel>
</rss>

