<?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 Trying to create a search that will use the results to feed another search and output the results in a table. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244082#M72640</link>
    <description>&lt;P&gt;So I have a search that tells me is someones account is locked.  I have been asked to create an alert or search that will tell me when someone's account is locked and has tried to login again.  Then output this as a table in an email.&lt;/P&gt;

&lt;P&gt;Search I use to find the locked accounts.&lt;BR /&gt;
index=Account Status=Locked&lt;/P&gt;

&lt;P&gt;Once I find the users that are locked, I want to feed those users into the second search, so that if they attempt tp login again, after being locked, I get a report with a table of the details I have been asked to provide.&lt;/P&gt;

&lt;P&gt;Search I use to create the table, when doing a manual search&lt;BR /&gt;
index=Account Status=Locked | table LoginTime, LoginStatus, FailureReason, Status, UserID&lt;/P&gt;

&lt;P&gt;How do I take the first search to feed the second with just locked accounts that are trying to login?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Tue, 05 Jul 2016 15:14:42 GMT</pubDate>
    <dc:creator>bworrellZP</dc:creator>
    <dc:date>2016-07-05T15:14:42Z</dc:date>
    <item>
      <title>Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244082#M72640</link>
      <description>&lt;P&gt;So I have a search that tells me is someones account is locked.  I have been asked to create an alert or search that will tell me when someone's account is locked and has tried to login again.  Then output this as a table in an email.&lt;/P&gt;

&lt;P&gt;Search I use to find the locked accounts.&lt;BR /&gt;
index=Account Status=Locked&lt;/P&gt;

&lt;P&gt;Once I find the users that are locked, I want to feed those users into the second search, so that if they attempt tp login again, after being locked, I get a report with a table of the details I have been asked to provide.&lt;/P&gt;

&lt;P&gt;Search I use to create the table, when doing a manual search&lt;BR /&gt;
index=Account Status=Locked | table LoginTime, LoginStatus, FailureReason, Status, UserID&lt;/P&gt;

&lt;P&gt;How do I take the first search to feed the second with just locked accounts that are trying to login?&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 15:14:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244082#M72640</guid>
      <dc:creator>bworrellZP</dc:creator>
      <dc:date>2016-07-05T15:14:42Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244083#M72641</link>
      <description>&lt;P&gt;It appears that you are already doing so.  Your question does not make sense; you should edit it and make it much more clear.  It usually helps a great deal if you show a few sample events and a mockup of your desired final output.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 15:20:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244083#M72641</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-07-05T15:20:53Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244084#M72642</link>
      <description>&lt;P&gt;Your second search should give you the desired output. You can save this search as an alert and if &lt;CODE&gt;count&amp;gt;0&lt;/CODE&gt; send an email&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.1/Alert/Emailnotification"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.1/Alert/Emailnotification&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 15:36:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244084#M72642</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-05T15:36:36Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244085#M72643</link>
      <description>&lt;P&gt;Thought about that, only thing I could not figure out, is how to make the alert per user.  If I have 5 people lock out, and none of them try to get in again, that's fine.  But if 5 lock out and only 1 tries to get in again, do not want that 1 to show up with the other 4.  (if that makes sense)&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 16:30:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244085#M72643</guid>
      <dc:creator>bworrellZP</dc:creator>
      <dc:date>2016-07-05T16:30:11Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244086#M72644</link>
      <description>&lt;P&gt;Sorry about that, left out a key piece there.  Updated the post.&lt;/P&gt;

&lt;P&gt;Short version, I need to track login attempts to locked accounts in an app we have.  Accounts lock after X failed attempts for Y time frame.  &lt;/P&gt;

&lt;P&gt;The output requirements are managed by another department.&lt;/P&gt;

&lt;P&gt;Need to get the locked accounts from the logs, then feed that user info to the other search in the event they log in again.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 16:34:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244086#M72644</guid>
      <dc:creator>bworrellZP</dc:creator>
      <dc:date>2016-07-05T16:34:31Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244087#M72645</link>
      <description>&lt;P&gt;Have 2 searches: 1 scheduled that updates a lookup file (or KV Store) for all UserIDs with "locked out" status.&lt;/P&gt;

&lt;P&gt;Then use a &lt;CODE&gt;subsearch&lt;/CODE&gt; to pull in that data to limit an outer search for login attempts like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your search that shows failed login attempts here [|inputlookup YourLockedOutLookupHere | table UserID]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jul 2016 16:42:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244087#M72645</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-07-05T16:42:07Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244088#M72646</link>
      <description>&lt;P&gt;Okay, so I can create a report to run every hour, and update the CSV with the User names that have failed to login.  That part I understand.&lt;/P&gt;

&lt;P&gt;Still a little foggy on how to use that lookup table for my search to pull usernames for.&lt;/P&gt;

&lt;P&gt;Using this search, index=Account Status=Locked | table LoginTime, LoginStatus, FailureReason, Status, UserID, how to I feed the look up into it?&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 17:53:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244088#M72646</guid>
      <dc:creator>bworrellZP</dc:creator>
      <dc:date>2016-07-05T17:53:41Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244089#M72647</link>
      <description>&lt;P&gt;See if this works (use the appropriate status for successful login)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Account Status=Locked OR Status=Login | stats latest(_time) as time by Status | where isnotnull(Locked) AND Login&amp;lt;Locked
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 05 Jul 2016 18:08:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244089#M72647</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-07-05T18:08:51Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244090#M72648</link>
      <description>&lt;P&gt;So the Locked status field is called Status.  The Login status is called Loginstatus.&lt;/P&gt;

&lt;P&gt;With that said, would this be the correct search?&lt;/P&gt;

&lt;P&gt;index=Account Status=Locked OR LoginStatus=Login | stats latest(_time) as time by Status | where isnotnull(Locked) AND Login&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 18:29:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244090#M72648</guid>
      <dc:creator>bworrellZP</dc:creator>
      <dc:date>2016-07-05T18:29:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244091#M72649</link>
      <description>&lt;P&gt;The lookup file should have &lt;CODE&gt;_time&lt;/CODE&gt; &lt;CODE&gt;UserID&lt;/CODE&gt; and &lt;CODE&gt;Status&lt;/CODE&gt; (you can get by without &lt;CODE&gt;Status&lt;/CODE&gt; but it will help make things clear to keep it at first).  You would do something like this to maintain it (scheduled every hour or whatever you need for granularity on your alert):&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=Account (Status="Locked" OR Status="Unlocked")
| appendpipe [|inputlookup YourLockedOutLookupHere ]
| sort 0 - _time | dedup UserID
| search Status="Locked"
| table _time Status UserID | outputlookup YourLockedOutLookupHere
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you have an up-to-date list of everyone whose last status is "Locked" and you can use this lookup as described in the original answer.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 18:46:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244091#M72649</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2016-07-05T18:46:12Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to create a search that will use the results to feed another search and output the results in a table.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244092#M72650</link>
      <description>&lt;P&gt;I think I have it now, had to go find another example.  I was running into a name error.&lt;/P&gt;

&lt;P&gt;Thank you for the suggestion.&lt;/P&gt;</description>
      <pubDate>Tue, 05 Jul 2016 19:20:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-create-a-search-that-will-use-the-results-to-feed/m-p/244092#M72650</guid>
      <dc:creator>bworrellZP</dc:creator>
      <dc:date>2016-07-05T19:20:05Z</dc:date>
    </item>
  </channel>
</rss>

