<?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: Matching events that happen within the micro-seconds apart in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220640#M176583</link>
    <description>&lt;P&gt;I think the autoregress command might help here. Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mssql:errorlog | eval event_time=strftime(_time,"%F %H:%M:%S.%2N")  | reverse 
| autoregress PutYourFieldHere as prev | where PutYourFieldHere=YourFilterCondition OR prev=YourFilterCondition
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So for your send example of Severity&amp;gt;16, it'll be like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mssql:errorlog | eval event_time=strftime(_time,"%F %H:%M:%S.%2N") | reverse 
| autoregress Severity as prev | where Severity&amp;gt;=16 OR prev&amp;gt;=16
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Tue, 04 Oct 2016 16:01:35 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-10-04T16:01:35Z</dc:date>
    <item>
      <title>Matching events that happen within the micro-seconds apart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220636#M176579</link>
      <description>&lt;P&gt;Hello guys,&lt;/P&gt;

&lt;P&gt;I'm working on monitoring our mssql error logs and running into a probably simple issue but I'm stumped. &lt;/P&gt;

&lt;P&gt;I'm searching for something like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mssql:errorlog error_id=17806
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which returns this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2016-10-03 14:30:37.77 Logon       Error: 17806, Severity: 20, State: 14.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However there is one event just above it that looks like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;    2016-10-03 14:30:37.77 Logon       SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which gives us the error message: Notice the time stamp of "2016-10-03 14:30:37.77"&lt;/P&gt;

&lt;P&gt;So I came up with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mssql:errorlog | eval event_time=strftime(_time,"%F %H:%M:%S.%2N") | search [ search sourcetype=mssql:errorlog error_id=17806 | eval event_time=_time | convert timeformat="%F %H:%M:%S.%2N" ctime(event_time) | fields event_time]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Logic here is we do a sub search for the _time value against all events. Which works, but now we are getting:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2016-10-03 14:30:37.77 Logon       Login failed. The login is from an untrusted domain and cannot be used with Windows authentication. [CLIENT: 192.168.112.94]
2016-10-03 14:30:37.77 Logon       Error: 18452, Severity: 14, State: 1.

2016-10-03 14:30:37.77 Logon       SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext failed. The Windows error code indicates the cause of failure. The logon attempt failed   [CLIENT: 192.168.112.94]
2016-10-03 14:30:37.77 Logon       Error: 17806, Severity: 20, State: 14.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Which returns additonal events with the time stamp "2016-10-03 14:30:37.77", how else might we achieve this to accurately match the single error_id with the prior event without returning additional events in the same time? &lt;/P&gt;

&lt;P&gt;Thanks &lt;/P&gt;</description>
      <pubDate>Mon, 03 Oct 2016 20:31:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220636#M176579</guid>
      <dc:creator>dondky</dc:creator>
      <dc:date>2016-10-03T20:31:00Z</dc:date>
    </item>
    <item>
      <title>Re: Matching events that happen within the micro-seconds apart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220637#M176580</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mssql:errorlog | eval event_time=strftime(_time,"%F %H:%M:%S.%2N") | search [ search sourcetype=mssql:errorlog error_id=17806 | eval event_time=_time | convert timeformat="%F %H:%M:%S.%2N" ctime(event_time) | fields event_time] | reverse | streamstats current=f window=1 values(error_id) as prev | where error_id=17806 OR prev=17806
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 03 Oct 2016 20:50:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220637#M176580</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-03T20:50:10Z</dc:date>
    </item>
    <item>
      <title>Re: Matching events that happen within the micro-seconds apart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220638#M176581</link>
      <description>&lt;P&gt;Thanks for the fast response, however, not sure if this will work, I mean it gets the job done but what happens when we aren't searching for a specific error_id but filtering on severity_level instead:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mssql:errorlog | eval event_time=strftime(_time,"%F %H:%M:%S.%2N") | search [ search sourcetype=mssql:errorlog severity_level &amp;gt;= 16 | eval event_time=_time | convert timeformat="%F %H:%M:%S.%2N" ctime(event_time) | fields event_time]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Plus not to keen on having to redefine error_id twice. I'll continue poking at this.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 11:12:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220638#M176581</guid>
      <dc:creator>dondky</dc:creator>
      <dc:date>2020-09-29T11:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: Matching events that happen within the micro-seconds apart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220639#M176582</link>
      <description>&lt;P&gt;Here is an example when I run based on severity levels &amp;gt;= 16. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2016-10-04 09:57:17.48 spid41s     An error occurred in a Service Broker/Database Mirroring transport connection endpoint, Error: 8474, State: 11. (Near endpoint role: Target, far endpoint address: '')

2016-10-04 09:57:17.48 spid41s     Error: 9642, Severity: 16, State: 3.

2016-10-04 09:57:16.48 Logon       Length specified in network packet payload did not match number of bytes read; the connection has been closed. Please contact the vendor of the client library. [CLIENT: 192.168.97.39]

2016-10-04 09:57:16.48 Logon       Error: 17836, Severity: 20, State: 17.

2016-10-04 05:09:00.98 spid45s     An error occurred in a Service Broker/Database Mirroring transport connection endpoint, Error: 8474, State: 11. (Near endpoint role: Target, far endpoint address: '')
2016-10-04 05:09:00.98 spid45s     Error: 9642, Severity: 16, State: 3.

2016-10-04 05:08:59.97 Logon       Length specified in network packet payload did not match number of bytes read; the connection has been closed. Please contact the vendor of the client library. [CLIENT: 192.168.97.225]

2016-10-04 05:08:59.97 Logon       Error: 17836, Severity: 20, State: 17.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm wondering if transaction can help.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 15:05:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220639#M176582</guid>
      <dc:creator>dondky</dc:creator>
      <dc:date>2016-10-04T15:05:09Z</dc:date>
    </item>
    <item>
      <title>Re: Matching events that happen within the micro-seconds apart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220640#M176583</link>
      <description>&lt;P&gt;I think the autoregress command might help here. Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mssql:errorlog | eval event_time=strftime(_time,"%F %H:%M:%S.%2N")  | reverse 
| autoregress PutYourFieldHere as prev | where PutYourFieldHere=YourFilterCondition OR prev=YourFilterCondition
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So for your send example of Severity&amp;gt;16, it'll be like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype=mssql:errorlog | eval event_time=strftime(_time,"%F %H:%M:%S.%2N") | reverse 
| autoregress Severity as prev | where Severity&amp;gt;=16 OR prev&amp;gt;=16
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 04 Oct 2016 16:01:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220640#M176583</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-10-04T16:01:35Z</dc:date>
    </item>
    <item>
      <title>Re: Matching events that happen within the micro-seconds apart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220641#M176584</link>
      <description>&lt;P&gt;Thx, I'll re-test this. I think I've been overthinking it severely and maybe just alerting on multiple matches is ok. However I'll poke at these autogress commands prior.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2016 16:10:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220641#M176584</guid>
      <dc:creator>dondky</dc:creator>
      <dc:date>2016-10-04T16:10:33Z</dc:date>
    </item>
    <item>
      <title>Re: Matching events that happen within the micro-seconds apart</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220642#M176585</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;You can use code below to "sort" events in more granular way to overcome default timestamp ingranularity (no milliseconds). Verified, it works.&lt;/P&gt;

&lt;P&gt;Field "_cd" is an internal field in a format of :. Each event belows to a bucket and has offset (position) in raw data file)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;sourcetype="mssql:errorlog"
| rex field=_cd "(?&amp;lt;bucket&amp;gt;\d+):(?&amp;lt;address&amp;gt;\d+)"
| sort _time, address
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Output example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2018-11-25 14:03:19.**19** Server      Microsoft SQL Server 2016 (SP1-CU3) (KB4019916) - 13.0.4435.0 (X64) 
    Apr 27 2017 17:36:12 
    Copyright (c) Microsoft Corporation
    Standard Edition (64-bit) on Windows Server 2012 R2 Standard 6.3 &amp;lt;X64&amp;gt; (Build 9600: ) (Hypervisor)
2018-11-25 14:03:19.19 Server      UTC adjustment: 1:00
2018-11-25 14:03:19.19 Server      (c) Microsoft Corporation.
2018-11-25 14:03:19.19 Server      All rights reserved.
2018-11-25 14:03:19.19 Server      Server process ID is 2460.
2018-11-25 14:03:19.19 Server      System Manufacturer: 'VMware, Inc.', System Model: 'VMware Virtual Platform'.
2018-11-25 14:03:19.19 Server      Authentication mode is MIXED.
2018-11-25 14:03:19.19 Server      Logging SQL Server messages in file 'E:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log\ERRORLOG'.
2018-11-25 14:03:19.19 Server      The service account is 'EZCORP\Y1017783'. This is an informational message; no user action is required.
2018-11-25 14:03:19.19 Server      Registry startup parameters: 
     -d E:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\master.mdf
     -e E:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\Log\ERRORLOG
     -l E:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
2018-11-25 14:03:19.**19** Server      Command Line Startup Parameters:
     -s "MSSQLSERVER"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;--tm&lt;/P&gt;</description>
      <pubDate>Thu, 06 Dec 2018 10:57:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Matching-events-that-happen-within-the-micro-seconds-apart/m-p/220642#M176585</guid>
      <dc:creator>tomasmoser</dc:creator>
      <dc:date>2018-12-06T10:57:59Z</dc:date>
    </item>
  </channel>
</rss>

