<?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: stats count eval match issue in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510497#M142876</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223981"&gt;@spitchika&lt;/a&gt;&amp;nbsp;- thx for the reply. With the help of a fellow Splunker the issue was I need single quotes and not double quotes for field name in the eval commands as such:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" Application="app1"
| dedup _time
| eval time = _time
| bin time span=15m
| stats count("Activity Name") as Attempts, count(eval(match('Activity Name',"FAILED LOGIN"))) as Failed, count(eval(match('Activity Name',"AUTHENTICATION"))) as Success earliest(_time) as FirstAttempt latest(_time) as LatestAttempt by Username time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jul 2020 17:24:40 GMT</pubDate>
    <dc:creator>jwalzerpitt</dc:creator>
    <dc:date>2020-07-22T17:24:40Z</dc:date>
    <item>
      <title>stats count eval match issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510483#M142873</link>
      <description>&lt;P&gt;I have a generic search that is looking for logins and there is a field that has two values – “authentication” for a successful login, and “failed login” for a failed login.&lt;/P&gt;&lt;P&gt;So I modified an existing search that looks for X amount &amp;gt;=3 attempts with success &amp;gt;0 and failed &amp;gt;=3 within 15 mins like so:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" Application="app1"
| dedup _time
| eval time = _time
| bin time span=15m
| stats count("Activity Name") as Attempts, count(eval(match("Activity Name","FAILED LOGIN"))) as Failed, count(eval(match("Activity Name","AUTHENTICATION"))) as Success earliest(_time) as FirstAttempt latest(_time) as LatestAttempt by Username time
| rename time as _time
| search Attempts&amp;gt;=3 AND Success&amp;gt;0 AND Failed&amp;gt;=3
| eval FirstAttempt=strftime(FirstAttempt,"%x %X")
| eval LatestAttempt=strftime(LatestAttempt,"%x %X")&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For some reason it is not liking the count(eval(match as if I shorten the search to the following,&amp;nbsp;I see results for attempts, but nothing for success or failed&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" Application="app1"
| dedup _time
| eval time = _time
| bin time span=15m
| stats count("Activity Name") as Attempts, count(eval(match("Activity Name","FAILED LOGIN"))) as Failed, count(eval(match("Activity Name","AUTHENTICATION"))) as Success&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any help would be greatly appreciated&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thx&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 15:27:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510483#M142873</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2020-07-22T15:27:59Z</dc:date>
    </item>
    <item>
      <title>Re: stats count eval match issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510485#M142874</link>
      <description>&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am not able to try this as I am not having logs.&lt;/P&gt;&lt;P&gt;But did we miss "if" in it??&lt;/P&gt;&lt;P&gt;Can you try like below?&lt;/P&gt;&lt;P&gt;count(eval(&lt;STRONG&gt;if&lt;/STRONG&gt;((match("Activity Name" == "FAILED LOGIN"&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 15:52:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510485#M142874</guid>
      <dc:creator>spitchika</dc:creator>
      <dc:date>2020-07-22T15:52:01Z</dc:date>
    </item>
    <item>
      <title>Re: stats count eval match issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510497#M142876</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223981"&gt;@spitchika&lt;/a&gt;&amp;nbsp;- thx for the reply. With the help of a fellow Splunker the issue was I need single quotes and not double quotes for field name in the eval commands as such:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="foo" host="bar" Application="app1"
| dedup _time
| eval time = _time
| bin time span=15m
| stats count("Activity Name") as Attempts, count(eval(match('Activity Name',"FAILED LOGIN"))) as Failed, count(eval(match('Activity Name',"AUTHENTICATION"))) as Success earliest(_time) as FirstAttempt latest(_time) as LatestAttempt by Username time&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 17:24:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510497#M142876</guid>
      <dc:creator>jwalzerpitt</dc:creator>
      <dc:date>2020-07-22T17:24:40Z</dc:date>
    </item>
    <item>
      <title>Re: stats count eval match issue</title>
      <link>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510513#M142881</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/103102"&gt;@jwalzerpitt&lt;/a&gt;&amp;nbsp; Thank you for mentioning correct answer&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jul 2020 18:54:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/stats-count-eval-match-issue/m-p/510513#M142881</guid>
      <dc:creator>spitchika</dc:creator>
      <dc:date>2020-07-22T18:54:19Z</dc:date>
    </item>
  </channel>
</rss>

