<?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: Join Statement Not Retrieving All Records in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212712#M62333</link>
    <description>&lt;P&gt;try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/authentication/users splunk_server=local   
     | fields title  
     | rename title as user  
     | join user [search index=_audit action=edit_user (operation=create OR operation=edit)
              | rename object as user       
              | stats list(timestamp) as "created" by user]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 19 Feb 2016 09:22:07 GMT</pubDate>
    <dc:creator>gyslainlatsa</dc:creator>
    <dc:date>2016-02-19T09:22:07Z</dc:date>
    <item>
      <title>Join Statement Not Retrieving All Records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212708#M62329</link>
      <description>&lt;P&gt;Hi, I wonder whether someone may be able to help me please for which may seem a really dumb question.&lt;/P&gt;

&lt;P&gt;I'm using the query below to extract user accounts with a creation date which returns 430 records.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/authentication/users splunk_server=local   
| fields title  
| rename title as user  
| join user [search index=_audit action=edit_user operation=create
         | rename object as user       
         | stats list(timestamp) as "created" by user]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The problem I have is that I should have a list of 440 which I then want to add the date against. &lt;/P&gt;

&lt;P&gt;Could someone tell me please why I'm not able to create the full list.&lt;/P&gt;

&lt;P&gt;I do know that some of the accounts don't have "operation=create" value in the raw data but rather "operation=edit", but either way I would have thought the full list should be created and then if the subsearch doesn't match then the date entry will be blank.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 08:42:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212708#M62329</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-19T08:42:58Z</dc:date>
    </item>
    <item>
      <title>Re: Join Statement Not Retrieving All Records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212709#M62330</link>
      <description>&lt;P&gt;the operation field has other values other than create and edit?&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 09:09:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212709#M62330</guid>
      <dc:creator>gyslainlatsa</dc:creator>
      <dc:date>2016-02-19T09:09:53Z</dc:date>
    </item>
    <item>
      <title>Re: Join Statement Not Retrieving All Records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212710#M62331</link>
      <description>&lt;P&gt;Since you're just getting the username from the first search, but there's a username in the second search, there's no need to join.  just drop the first search so that you're left with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit action=edit_user (operation=create OR operation=edit)
              | rename object as user       
              | stats list(timestamp) as "created" by user
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you really must join though, add max=0, and you might also need to look into limits.conf settings.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/authentication/users splunk_server=local   
     | fields title  
     | rename title as user  
     | join user max=0 [search index=_audit action=edit_user operation=create OR operation=edit
              | rename object as user       
              | stats list(timestamp) as "created" by user]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2016 09:14:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212710#M62331</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-02-19T09:14:08Z</dc:date>
    </item>
    <item>
      <title>Re: Join Statement Not Retrieving All Records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212711#M62332</link>
      <description>&lt;P&gt;Hi @jkat54, thank you for coming back to me with this.&lt;/P&gt;

&lt;P&gt;As you were kindly writing your reply, I was finding a solution myself and came up with the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_audit action=edit_user operation=edit OR operation=create
|rename object as user
     |eval timestamp=strptime(timestamp, "%m-%d-%Y %H:%M:%S.%3N") 
     |convert timeformat="%d/%b/%Y" ctime(timestamp)
     |stats max(timestamp) as "created" by user
 |join user [|rest /services/authentication/users splunk_server=local 
 |fields title
 |rename title as user]
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I know it's not the most efficient query because of it's runtime, but it is now returning all the records.&lt;/P&gt;

&lt;P&gt;Many thanks for your help and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 09:21:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212711#M62332</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-19T09:21:55Z</dc:date>
    </item>
    <item>
      <title>Re: Join Statement Not Retrieving All Records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212712#M62333</link>
      <description>&lt;P&gt;try like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| rest /services/authentication/users splunk_server=local   
     | fields title  
     | rename title as user  
     | join user [search index=_audit action=edit_user (operation=create OR operation=edit)
              | rename object as user       
              | stats list(timestamp) as "created" by user]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 19 Feb 2016 09:22:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212712#M62333</guid>
      <dc:creator>gyslainlatsa</dc:creator>
      <dc:date>2016-02-19T09:22:07Z</dc:date>
    </item>
    <item>
      <title>Re: Join Statement Not Retrieving All Records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212713#M62334</link>
      <description>&lt;P&gt;Hi, thank you for coming back to me with this.&lt;/P&gt;

&lt;P&gt;I did try the query you kindly provided, but unfortunately this doesn't retrieve all the records.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 09:25:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212713#M62334</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2016-02-19T09:25:57Z</dc:date>
    </item>
    <item>
      <title>Re: Join Statement Not Retrieving All Records</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212714#M62335</link>
      <description>&lt;P&gt;I see what you did there and I think it's pretty swift.  I've just got one user locally but the search completes rather quickly for me.  I changed your comment to answer so that you may mark it as such.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Feb 2016 10:24:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Join-Statement-Not-Retrieving-All-Records/m-p/212714#M62335</guid>
      <dc:creator>jkat54</dc:creator>
      <dc:date>2016-02-19T10:24:21Z</dc:date>
    </item>
  </channel>
</rss>

