<?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: using transaction command in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-that-triggers-when-a-certain-number-of/m-p/644880#M223320</link>
    <description>&lt;P&gt;Something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transaction user startswith="login=failed" endswith="login=succeeded" maxspan=5m maxevents=4 keepevicted=true
| where closed_txn == 0&lt;/LI-CODE&gt;</description>
    <pubDate>Mon, 29 May 2023 06:38:16 GMT</pubDate>
    <dc:creator>yuanliu</dc:creator>
    <dc:date>2023-05-29T06:38:16Z</dc:date>
    <item>
      <title>How to create an alert that triggers when a certain number of failed logins are reported using transaction command?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-that-triggers-when-a-certain-number-of/m-p/644858#M223304</link>
      <description>&lt;P&gt;I am trying to create an alert that triggers when a certain number of failed logins are reported in a 5 minute time period.&lt;/P&gt;
&lt;P&gt;Specifically, when a given user fails to login 3 successive times without a successful login in the next login attempt I want the alert to fire and list the failed login attempts (user and _time ).&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;1) events below trigger alert&lt;/P&gt;
&lt;P&gt;user&amp;nbsp; &amp;nbsp; &amp;nbsp;time&amp;nbsp; login attempt status&lt;/P&gt;
&lt;P&gt;smith 12:01 failed&lt;BR /&gt;smith 12:03 failed&lt;BR /&gt;smith 12:04 failed&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;2) below events will NOT trigger alert since the last event is a successful login&lt;/P&gt;
&lt;P&gt;user&amp;nbsp; &amp;nbsp; time&amp;nbsp; &amp;nbsp; login attempt status&lt;/P&gt;
&lt;P&gt;smith 12:01 failed&lt;BR /&gt;smith 12:02 failed&lt;BR /&gt;smith 12:03 failed&lt;BR /&gt;smith 12:04 succeeded&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;how do i create a splunk query(using the transaction command presumably) to identify user login attempts that meet the trigger condition?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 30 May 2023 03:39:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-that-triggers-when-a-certain-number-of/m-p/644858#M223304</guid>
      <dc:creator>pc1234</dc:creator>
      <dc:date>2023-05-30T03:39:32Z</dc:date>
    </item>
    <item>
      <title>Re: using transaction command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-that-triggers-when-a-certain-number-of/m-p/644865#M223310</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/144424"&gt;@pc1234&lt;/a&gt;&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Here's a run anywhere example showing you a method to do this...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="user,login_attempt_status
smith,failed
smith,failed
smith,succeeded
smith,failed
jones,failed
jones,failed
jones,succeeded
smith,failed
smith,failed
smith,failed
smith,failed"
| multikv forceheader=1 | streamstats count | eval _time=_time+(count*60)
| sort _time
| table _time user login_attempt_status
  ``` ^^^ above just creates dummy events ^^^ ```
| sort user _time   ``` events need to be sorted by user and _time for following streamstats command to work ```
| streamstats reset_on_change=true window=3 count BY user login_attempt_status   ``` count previous 3 login_attempt_status and reset count on group by changes ```
| stats max(_time) AS _time latest(*) AS * BY user   ``` what's the latest ```
| where count=3 AND login_attempt_status="failed"    ``` alert on this condition ```&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hope that helps&lt;/P&gt;</description>
      <pubDate>Mon, 29 May 2023 00:47:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-that-triggers-when-a-certain-number-of/m-p/644865#M223310</guid>
      <dc:creator>yeahnah</dc:creator>
      <dc:date>2023-05-29T00:47:11Z</dc:date>
    </item>
    <item>
      <title>Re: using transaction command</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-that-triggers-when-a-certain-number-of/m-p/644880#M223320</link>
      <description>&lt;P&gt;Something like&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| transaction user startswith="login=failed" endswith="login=succeeded" maxspan=5m maxevents=4 keepevicted=true
| where closed_txn == 0&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 29 May 2023 06:38:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-an-alert-that-triggers-when-a-certain-number-of/m-p/644880#M223320</guid>
      <dc:creator>yuanliu</dc:creator>
      <dc:date>2023-05-29T06:38:16Z</dc:date>
    </item>
  </channel>
</rss>

