<?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: How to search the count of successful and failed logins, the ratio by IP, and the usernames successfully logged in from those IP addresses? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135371#M37018</link>
    <description>&lt;P&gt;Many thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Jun 2015 07:26:37 GMT</pubDate>
    <dc:creator>markwymer</dc:creator>
    <dc:date>2015-06-05T07:26:37Z</dc:date>
    <item>
      <title>How to search the count of successful and failed logins, the ratio by IP, and the usernames successfully logged in from those IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135367#M37014</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;'fraid I'm still a newbie, so I am probably trying to do too much or the impossible but I'll try and explain what I am trying to achieve.&lt;/P&gt;

&lt;P&gt;One of the logs that we are feeding into Splunk contains (amongst the millions of events) data that provides info for logon status, IP address and username and real name e.g.&lt;BR /&gt;
(cut down example) &lt;BR /&gt;
&lt;EM&gt;Logon for 192.168.0.10 username &lt;A href="mailto:abc@mail.com"&gt;abc@mail.com&lt;/A&gt; realname Jeff&lt;BR /&gt;
Logon error 192.168.0.10 username mylogonname realname Bert&lt;BR /&gt;
etc&lt;/EM&gt;&lt;/P&gt;

&lt;P&gt;I've created field extractions called &lt;CODE&gt;Logon_Status&lt;/CODE&gt;, &lt;CODE&gt;Logon_Source_IP&lt;/CODE&gt;,  &lt;CODE&gt;Logon_Username&lt;/CODE&gt; and &lt;CODE&gt;Logon_Realname&lt;/CODE&gt;- so far so good.&lt;/P&gt;

&lt;P&gt;I need, now, to create a report based on the logon success ratio to logon failure by IP address. Then using the IP information from that, search for any usernames that were successfully logged on to from those IP addresses. e.g.&lt;BR /&gt;
192.168.0.10 &lt;A href="mailto:abc@mail.com"&gt;abc@mail.com&lt;/A&gt; Jeff&lt;/P&gt;

&lt;P&gt;To get the logon ratio, I used:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="splunk_testdata.log" host="test" index="testdata"  | stats count(eval(Logon_Status="for")) as Successful, count(eval(Logon_Status="error")) as Failed by Logon_Source_IP | where ((Successful/Failed) * 100 &amp;gt; 0.000001) AND ((Successful/Failed) * 100 &amp;lt; 10) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This gives me the correct list of IP addresses and, having recently read about subsearches, I thought that I could use that to get the rest of the required results for those IP addresses:-&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="splunk_testdata.log" host="test" index="testdata" Logon_Status="for" [ search source="splunk_testdata.log" host="test" index="testdata" logon | stats count(eval(Logon_Status="for")) as Successful, count(eval(Logon_Status="error")) as Failed by Logon_Source_IP | where ((Successful/Failed) * 100 &amp;gt; 0.000001) AND ((Successful/Failed) * 100 &amp;lt; 10) | fields Logon_Source_IP ]  | table Logon_Source_IP, Logon_Username, Logon_Realname
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In the table, I can see the correct data for &lt;CODE&gt;Logon_Source_IP&lt;/CODE&gt;, &lt;CODE&gt;Logon_Username&lt;/CODE&gt; and &lt;CODE&gt;Logon_Realname&lt;/CODE&gt;.&lt;/P&gt;

&lt;P&gt;What I would, ideally, like to do as add the 'Successful' and 'Failed' counts, calculated from the subsearch. Is this at all possible or would I have to another 'stats count' somewhere in my search?&lt;/P&gt;

&lt;P&gt;Am I approaching this problem from the wrong direction by using subsearches to isolate the IP addresses?&lt;/P&gt;

&lt;P&gt;The table that I am trying to create is.....&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;IP Address    Account       Real Name   Total Successful For IP Addr   Total Failed For IP Addr
192.168.0.10  abc@mail.com  Jeff                      1                           22
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;(hope the formatting works!) &lt;/P&gt;

&lt;P&gt;Any and all help gratefully received,&lt;BR /&gt;
Mark.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 05:55:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135367#M37014</guid>
      <dc:creator>markwymer</dc:creator>
      <dc:date>2015-06-04T05:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of successful and failed logins, the ratio by IP, and the usernames successfully logged in from those IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135368#M37015</link>
      <description>&lt;P&gt;Hello! I think you can build your table whithout using a subsearch. Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; source="splunk_testdata.log" host="test" index="testdata"  | eventstats count(eval(Logon_Status="for")) as Successful by Logon_Source_IP| eventstats  count(eval(Logon_Status="error")) as Failed by Logon_Source_IP | where ((Successful/Failed) * 100 &amp;gt; 0.000001) AND ((Successful/Failed) * 100 &amp;lt; 10) |stats  values(Logon_Username) as Account values(Logon_Realname) as "Real Name"  values(Successful) as "Total Successful For IP Addr"  values(Failed) as "Total Failed For IP Addr" by Logon_Source_IP|rename Logon_Source_IP as "IP Addres"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 09:59:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135368#M37015</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-04T09:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of successful and failed logins, the ratio by IP, and the usernames successfully logged in from those IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135369#M37016</link>
      <description>&lt;P&gt;Hi Stephan,&lt;/P&gt;

&lt;P&gt;Thanks for sparing the time to post your solution - it looks a lot neater than mine!&lt;/P&gt;

&lt;P&gt;Without wishing to seem ungrateful, the search returns all of the Account names whether they successfully logged in to or not. I only, really, need to see the usernames for the accounts that where successfully logged into in the final report. &lt;/P&gt;

&lt;P&gt;But, again, thank you for pointing me in the right direction, I'll &lt;/P&gt;</description>
      <pubDate>Thu, 04 Jun 2015 14:00:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135369#M37016</guid>
      <dc:creator>markwymer</dc:creator>
      <dc:date>2015-06-04T14:00:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of successful and failed logins, the ratio by IP, and the usernames successfully logged in from those IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135370#M37017</link>
      <description>&lt;P&gt;In that case, just remove Failed values on your table. Here you go!&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="splunk_testdata.log" host="test" index="testdata"  | eventstats count(eval(Logon_Status="for")) as Successful by Logon_Source_IP| eventstats  count(eval(Logon_Status="error")) as Failed by Logon_Source_IP | where ((Successful/Failed) * 100 &amp;gt; 0.000001) AND ((Successful/Failed) * 100 &amp;lt; 10) |stats  values(Logon_Username) as Account values(Logon_Realname) as "Real Name"  values(Successful) as "Total Successful For IP Addr"  by Logon_Source_IP|rename Logon_Source_IP as "IP Addres"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Jun 2015 19:19:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135370#M37017</guid>
      <dc:creator>stephanefotso</dc:creator>
      <dc:date>2015-06-04T19:19:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to search the count of successful and failed logins, the ratio by IP, and the usernames successfully logged in from those IP addresses?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135371#M37018</link>
      <description>&lt;P&gt;Many thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Jun 2015 07:26:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-search-the-count-of-successful-and-failed-logins-the/m-p/135371#M37018</guid>
      <dc:creator>markwymer</dc:creator>
      <dc:date>2015-06-05T07:26:37Z</dc:date>
    </item>
  </channel>
</rss>

