<?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 write a search query to monitor account for specific duration? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-write-a-search-query-to-monitor-account-for-specific/m-p/331790#M39751</link>
    <description>&lt;P&gt;I would have a search that runs daily like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-25h@h index=YourIndexHere sourcetype=YourSourcetypeHere EventCode=4720 
| dedup Account_Name 
| eval Account_Name = mvindex(Account_Name, 1) 
| table _time Account_Name
| rename _time AS Birthday
| appendpipe [|inputlookup NewUsersLastFifteenDays]
| dedup Account_Name
| where Birthday &amp;gt;= relative_time(now, "-15d@d")
| fieldformat Birthday = strftime(Birthday, "%m/%d/%Y %H:%M:%S")
| outputlookup NewUsersLastFifteenDays
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you have a lookup that tells you whether the user is under monitoring that you can use at any time in any search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YourIndexHere sourcetype=YourSourcetypeHere | lookup NewUsersLastFifteenDays | search Birthday="*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YourIndexHere sourcetype=YourSourcetypeHere [|inputlookup NewUsersLastFifteenDays | fields Account_Name]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 31 May 2017 15:18:26 GMT</pubDate>
    <dc:creator>woodcock</dc:creator>
    <dc:date>2017-05-31T15:18:26Z</dc:date>
    <item>
      <title>How to write a search query to monitor account for specific duration?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-write-a-search-query-to-monitor-account-for-specific/m-p/331789#M39750</link>
      <description>&lt;P&gt;Hello All,&lt;/P&gt;

&lt;P&gt;I need to monitor newly created user account for next 15 days. &lt;/P&gt;

&lt;P&gt;I need a query where it will look for windows event code 4720, then extract the account name and put it for monitoring for next 15 days. Any activity from that account should logged. After 15 days, that account will be removed from monitoring. Same will repeat for all newly created user accounts.&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 14:34:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-write-a-search-query-to-monitor-account-for-specific/m-p/331789#M39750</guid>
      <dc:creator>nnimbe</dc:creator>
      <dc:date>2017-05-31T14:34:27Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search query to monitor account for specific duration?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-write-a-search-query-to-monitor-account-for-specific/m-p/331790#M39751</link>
      <description>&lt;P&gt;I would have a search that runs daily like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest=-25h@h index=YourIndexHere sourcetype=YourSourcetypeHere EventCode=4720 
| dedup Account_Name 
| eval Account_Name = mvindex(Account_Name, 1) 
| table _time Account_Name
| rename _time AS Birthday
| appendpipe [|inputlookup NewUsersLastFifteenDays]
| dedup Account_Name
| where Birthday &amp;gt;= relative_time(now, "-15d@d")
| fieldformat Birthday = strftime(Birthday, "%m/%d/%Y %H:%M:%S")
| outputlookup NewUsersLastFifteenDays
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now you have a lookup that tells you whether the user is under monitoring that you can use at any time in any search like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YourIndexHere sourcetype=YourSourcetypeHere | lookup NewUsersLastFifteenDays | search Birthday="*"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=YourIndexHere sourcetype=YourSourcetypeHere [|inputlookup NewUsersLastFifteenDays | fields Account_Name]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 31 May 2017 15:18:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-write-a-search-query-to-monitor-account-for-specific/m-p/331790#M39751</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-05-31T15:18:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to write a search query to monitor account for specific duration?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-write-a-search-query-to-monitor-account-for-specific/m-p/331791#M39752</link>
      <description>&lt;P&gt;hello there, &lt;BR /&gt;
not sure i understand in full, what do you mean by "monitoring the account names for 15 days"? if you collect these logs anyways you have that data.&lt;BR /&gt;
one approach can be to use a lookup table, something of this sort:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;earliest= -15d@d latest=now index = Yourindex sourcetype=YourSourcetpye EventCode=4720 | table _time user | outputlookup new_accounts.csv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;save this search to run daily so the lookup updates and you always have a list of 15 days worth of new users&lt;BR /&gt;
now you can search leveraging the lookup command against your new lookup:&lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Lookup&lt;/A&gt;&lt;BR /&gt;
hope it helps&lt;/P&gt;</description>
      <pubDate>Wed, 31 May 2017 15:22:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/How-to-write-a-search-query-to-monitor-account-for-specific/m-p/331791#M39752</guid>
      <dc:creator>adonio</dc:creator>
      <dc:date>2017-05-31T15:22:31Z</dc:date>
    </item>
  </channel>
</rss>

