<?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 edit my search to extract Splunk user accounts and the dates they were created? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282439#M85294</link>
    <description>&lt;P&gt;Hi thank you for coming back to me and my apologies for not coming back to you sooner.&lt;/P&gt;

&lt;P&gt;Although I've had to raise another ticket to ask for someone to check my logic, I think I may have solved this with the query as shown in the answer section.&lt;/P&gt;

&lt;P&gt;Kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Wed, 17 Feb 2016 14:02:41 GMT</pubDate>
    <dc:creator>IRHM73</dc:creator>
    <dc:date>2016-02-17T14:02:41Z</dc:date>
    <item>
      <title>How to edit my search to extract Splunk user accounts and the dates they were created?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282434#M85289</link>
      <description>&lt;P&gt;Hi, I wonder whether someone may be able to help me please.&lt;/P&gt;

&lt;P&gt;I'm using the search below to extract the date when Splunk user accounts have been created: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit action=edit_user operation=create
|rename object as user
|eval timestamp=strptime(timestamp, "%m-%d-%Y %H:%M:%S.%3N") 
|convert timeformat="%d/%b/%Y" ctime(timestamp)
|table user timestamp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I'm then using the search below to extract a list of all user accounts:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; |rest /services/authentication/users splunk_server=local 
 |fields realname
 |rename realname as user
 |table user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What I'd like to do is display a list of all user accounts and if they have been created within a chosen time range with the date next to them.&lt;/P&gt;

&lt;P&gt;So I've then tried to combine the two using the search below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit action=edit_user operation=create
|fields object
|rename object as user
|eval timestamp=strptime(timestamp, "%m-%d-%Y %H:%M:%S.%3N") 
|convert timeformat="%d/%b/%Y" ctime(timestamp)
       |join user[search |rest /services/authentication/users splunk_server=local 
       |fields realname
       |rename realname as user
        |table user]
|table user timestamp
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem I have is that when I run this I receive the following error:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Error in 'rest' command: This command must be the first command of a search.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I just wondered whether someone may be able to look at this please and let me know how I can get around this.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 13:08:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282434#M85289</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-16T13:08:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to extract Splunk user accounts and the dates they were created?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282435#M85290</link>
      <description>&lt;P&gt;Hello Chris,&lt;/P&gt;

&lt;P&gt;Please remove the &lt;CODE&gt;search&lt;/CODE&gt; just before the |rest  from subsearch. Ie &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Your searcch |join user [|rest /services/authentication/users splunk_server=local  rest of your search
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Feb 2016 13:17:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282435#M85290</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-16T13:17:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to extract Splunk user accounts and the dates they were created?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282436#M85291</link>
      <description>&lt;P&gt;Hi thank you for coming back to me with this.&lt;/P&gt;

&lt;P&gt;I've removed the search but it is not creating the list of accounts the the dates if they were set up in the given time period. &lt;/P&gt;

&lt;P&gt;It is also not displaying the full list of dates against the user names for accounts I know were created in my given time range.&lt;/P&gt;

&lt;P&gt;It's almost as if the subsearch is not being run.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 13:47:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282436#M85291</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-16T13:47:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to extract Splunk user accounts and the dates they were created?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282437#M85292</link>
      <description>&lt;P&gt;Have you considered using rest to create a lookup table for your users, and then use the lookup table in your base search, instead of rest?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Feb 2016 14:27:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282437#M85292</guid>
      <dc:creator>esix_splunk</dc:creator>
      <dc:date>2016-02-16T14:27:26Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to extract Splunk user accounts and the dates they were created?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282438#M85293</link>
      <description>&lt;P&gt;Hi Chris,&lt;/P&gt;

&lt;UL&gt;
&lt;LI&gt;Are you getting result for the search &lt;CODE&gt;|rest /services/authentication/users splunk_server=local&lt;/CODE&gt; ?&lt;/LI&gt;
&lt;LI&gt;Are you getting the result for the search &lt;CODE&gt;index=_audit action=edit_user operation=create&lt;/CODE&gt; ?&lt;/LI&gt;
&lt;LI&gt;Also you might need to use &lt;CODE&gt;title&lt;/CODE&gt; from rest as user instead of &lt;CODE&gt;realname&lt;/CODE&gt;&lt;/LI&gt;
&lt;/UL&gt;</description>
      <pubDate>Wed, 17 Feb 2016 03:24:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282438#M85293</guid>
      <dc:creator>renjith_nair</dc:creator>
      <dc:date>2016-02-17T03:24:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to extract Splunk user accounts and the dates they were created?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282439#M85294</link>
      <description>&lt;P&gt;Hi thank you for coming back to me and my apologies for not coming back to you sooner.&lt;/P&gt;

&lt;P&gt;Although I've had to raise another ticket to ask for someone to check my logic, I think I may have solved this with the query as shown in the answer section.&lt;/P&gt;

&lt;P&gt;Kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2016 14:02:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282439#M85294</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-17T14:02:41Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to extract Splunk user accounts and the dates they were created?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282440#M85295</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;

&lt;P&gt;Thank you for taking the time to look at my post and for the help, but I have been able to solve this as follows:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rest /services/authentication/users splunk_server=local 
|fields title
|rename title as user
| join user type=left [
    | search index=_audit action="login attempt" earliest=-12mon
    | stats max(timestamp) as _time by user, sourcetype
 ]
 | where isnull(sourcetype)
 | fields - sourcetype
|join user type=outer [
    search index=_audit action=edit_user operation=edit earliest=0
    |rename object as user
    |eval timestamp=strptime(timestamp, "%m-%d-%Y %H:%M:%S.%3N") 
    |convert timeformat="%d/%b/%Y" ctime(timestamp)
    |stats min(timestamp) as "created" by user
]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Kind Regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2016 14:04:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282440#M85295</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-17T14:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to edit my search to extract Splunk user accounts and the dates they were created?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282441#M85296</link>
      <description>&lt;P&gt;Hi, thank you for replying.&lt;/P&gt;

&lt;P&gt;To be honest I hadn't thought about using a lookup table. May be this is an option  I could look into.&lt;/P&gt;

&lt;P&gt;Many thanks for the suggestion and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 17 Feb 2016 14:05:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-edit-my-search-to-extract-Splunk-user-accounts-and-the/m-p/282441#M85296</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-17T14:05:51Z</dc:date>
    </item>
  </channel>
</rss>

