<?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 How to join REST &amp;amp; search results? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-REST-amp-search-results/m-p/616177#M214152</link>
    <description>&lt;P&gt;I'm really bad when it comes to join searches, though I've been doing this for years.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm able to find the list of orphaned searches using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rest /servicesNS/-/-/admin/directory count=0 splunk_server=&amp;lt;splunkserver&amp;gt;
| rename eai:* as *, acl.* as * 
| eval updated=strptime(updated,"%Y-%m-%dT%H:%M:%S%Z"), updated=if(isnull(updated),"Never",strftime(updated,"%d %b %Y")) 
| sort type 
| eval sAMAccountName=owner 
| stats count by title orphaned sAMAccountName sharing type owner updated app disabled 
| search orphaned=1&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and we have a summary index containing our LDAP users &amp;amp; managers for those users. Using the following search returns users and their managers:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=metrics_summary source="LDAP*" source IN("LDAP GROUP USER DIVISION Summary Index Search" "LDAP_GROUP_USER_DIVISION_Summary_Index_Search" lookup_ldap_group_user_division) sAMAccountName=e* OR sAMAccountName=v* |table sAMAccountName displayName mail department division manager&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I haven't been able to join the two searches together to give me the manager name of the user w/ the orphan search. I've tried variations of the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rest /servicesNS/-/-/admin/directory count=0 splunk_server=&amp;lt;splunkserver&amp;gt; 
| rename eai:* as *, acl.* as * 
| eval updated=strptime(updated,"%Y-%m-%dT%H:%M:%S%Z"), updated=if(isnull(updated),"Never",strftime(updated,"%d %b %Y")) 
| sort type 
| eval sAMAccountName=owner 
| stats count by title orphaned sAMAccountName sharing type owner updated app disabled 
| search orphaned=1
| join sAMAccountName type=outer max=0 
    [|search index=metrics_summary source="LDAP*" source IN("LDAP GROUP USER DIVISION Summary Index Search" "LDAP_GROUP_USER_DIVISION_Summary_Index_Search" lookup_ldap_group_user_division) 
| stats latest(_time) AS latest values(displayName) values(mail) values(distinguishedName) values(department) values(division) latest(userAccountControl) values(manager) by sAMAccountName 
| rename values(*) AS *, latest(*) AS *]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but this only comes back w/ results from the rest call.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I get results using the summary index search. How do I merge these?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
    <pubDate>Thu, 06 Oct 2022 13:57:30 GMT</pubDate>
    <dc:creator>manderson7</dc:creator>
    <dc:date>2022-10-06T13:57:30Z</dc:date>
    <item>
      <title>How to join REST &amp; search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-REST-amp-search-results/m-p/616177#M214152</link>
      <description>&lt;P&gt;I'm really bad when it comes to join searches, though I've been doing this for years.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I'm able to find the list of orphaned searches using:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rest /servicesNS/-/-/admin/directory count=0 splunk_server=&amp;lt;splunkserver&amp;gt;
| rename eai:* as *, acl.* as * 
| eval updated=strptime(updated,"%Y-%m-%dT%H:%M:%S%Z"), updated=if(isnull(updated),"Never",strftime(updated,"%d %b %Y")) 
| sort type 
| eval sAMAccountName=owner 
| stats count by title orphaned sAMAccountName sharing type owner updated app disabled 
| search orphaned=1&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;and we have a summary index containing our LDAP users &amp;amp; managers for those users. Using the following search returns users and their managers:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index=metrics_summary source="LDAP*" source IN("LDAP GROUP USER DIVISION Summary Index Search" "LDAP_GROUP_USER_DIVISION_Summary_Index_Search" lookup_ldap_group_user_division) sAMAccountName=e* OR sAMAccountName=v* |table sAMAccountName displayName mail department division manager&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But I haven't been able to join the two searches together to give me the manager name of the user w/ the orphan search. I've tried variations of the following:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;| rest /servicesNS/-/-/admin/directory count=0 splunk_server=&amp;lt;splunkserver&amp;gt; 
| rename eai:* as *, acl.* as * 
| eval updated=strptime(updated,"%Y-%m-%dT%H:%M:%S%Z"), updated=if(isnull(updated),"Never",strftime(updated,"%d %b %Y")) 
| sort type 
| eval sAMAccountName=owner 
| stats count by title orphaned sAMAccountName sharing type owner updated app disabled 
| search orphaned=1
| join sAMAccountName type=outer max=0 
    [|search index=metrics_summary source="LDAP*" source IN("LDAP GROUP USER DIVISION Summary Index Search" "LDAP_GROUP_USER_DIVISION_Summary_Index_Search" lookup_ldap_group_user_division) 
| stats latest(_time) AS latest values(displayName) values(mail) values(distinguishedName) values(department) values(division) latest(userAccountControl) values(manager) by sAMAccountName 
| rename values(*) AS *, latest(*) AS *]&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;but this only comes back w/ results from the rest call.&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I know I get results using the summary index search. How do I merge these?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 13:57:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-REST-amp-search-results/m-p/616177#M214152</guid>
      <dc:creator>manderson7</dc:creator>
      <dc:date>2022-10-06T13:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to join REST &amp; search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-REST-amp-search-results/m-p/616183#M214155</link>
      <description>&lt;P&gt;How many results are you getting with the summary search? If it is more than 10k, then the subsearch will be limited to 10k results (if I remember correctly) and therefore you may be trimming the result set before doing the join.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If you have more than 10k results from your summary index search, I recommend trying to swap the positions of the REST search and the summary search. So run the summary search first and do the REST search as the subsearch.&lt;BR /&gt;&lt;BR /&gt;Also, you could try converting your sAMAccountName to lowercase in both searches to avoid case issues. Additionally, I recommend doing some sort of "stats .... by sAMAccountName" in your summary search in order to remove any possible duplicates which might be interfering with the join.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 14:24:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-REST-amp-search-results/m-p/616183#M214155</guid>
      <dc:creator>jdunlea</dc:creator>
      <dc:date>2022-10-06T14:24:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to join REST &amp; search results?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-join-REST-amp-search-results/m-p/616189#M214157</link>
      <description>&lt;P&gt;That helped quite a bit, thanks. The somewhat final search came out to be:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rest /servicesNS/-/-/admin/directory count=0 splunk_server=&amp;lt;splunkserver&amp;gt; 
| rename eai:* as *, acl.* as * 
| eval updated=strptime(updated,"%Y-%m-%dT%H:%M:%S%Z"), updated=if(isnull(updated),"Never",strftime(updated,"%d %b %Y")) 
| sort type 
| eval sAMAccountName=lower(owner) 
| stats count by title orphaned sAMAccountName sharing type owner updated app disabled 
| search orphaned=1
| join sAMAccountName
    [| search index=metrics_summary source="LDAP*" source IN("LDAP GROUP USER DIVISION Summary Index Search" "LDAP_GROUP_USER_DIVISION_Summary_Index_Search" lookup_ldap_group_user_division) sAMAccountName=e* OR sAMAccountName=v* NOT sAMAccountName=e-mail* userAccountControl=*ACCOUNTDISABLE* 
| eval sAMAccountName=lower(sAMAccountName) 
| stats latest(_time) AS latest values(displayName) values(mail) values(distinguishedName) values(department) values(division) latest(userAccountControl) values(manager) by sAMAccountName]&lt;/LI-CODE&gt;&lt;P&gt;I needed to limit the results more in the subsearch. Thanks so much.&lt;/P&gt;</description>
      <pubDate>Thu, 06 Oct 2022 14:54:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-join-REST-amp-search-results/m-p/616189#M214157</guid>
      <dc:creator>manderson7</dc:creator>
      <dc:date>2022-10-06T14:54:10Z</dc:date>
    </item>
  </channel>
</rss>

