<?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: LDAP all Hosts and are they Connected? in Deployment Architecture</title>
    <link>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555302#M18890</link>
    <description>&lt;P&gt;Surprisingly when we had professional services out initially, this was a long and convoluted search.&lt;/P&gt;&lt;P&gt;Ours essentially works like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;A scheduled search writes all ldap assets to a lookup table. Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| localop | ldapsearch domain="default" search="(objectClass=computer)" attrs="sAMAccountName, distinguishedName, dNSHostName, managedBy"

| rex max_match=5 field=distinguishedName "OU=(?&amp;lt;dn_parsed&amp;gt;[^,]+)" 
| eval category=lower(replace(mvjoin(dn_parsed, "|"), " ", "_"))
| eval priority=case(
   match(category, "domain_controller|exchange|citrix"), "critical", 
   match(category, "server|disabled"), "high", 
   match(category, "workstation|desktop|mobile|laptop"), "medium", 
   match(category, "staging|test"), "low", 
   1==1, "unknown"
)

| eval is_expected=if(priority=="high" OR priority=="critical", "true", "false")
| eval nt_host=replace(sAMAccountName, "\$", "")
| rename dNSHostName AS dns managedBy AS owner

| eval val2lookup = coalesce(dns, nt_host)
| lookup dnslookup clienthost as val2lookup output clientip as ip

| fillnull value="unknown" category, priority, bunit
| table ip,mac,nt_host,dns,owner,priority,lat,long,city,country,bunit,category,pci_domain,is_expected,should_timesync,should_update,requires_av

| dedup nt_host
| outputlookup ldap_assets&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another search then looks for all hosts in splunk and compares it to the lookup table above.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count  where index=* OR index=_* NOT host=127.0.0.1 by host index | eval host=lower(host)
| eval host=lower(case(match(host,"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"),host,match(host,"mydomain\.com$"),host,1==1,host.".mydomain.com"))
| append [ | inputlookup ldap_assets | makemv delim="|" category | search category=servers | mvexpand category | eval dns=lower(case(dns=="localhost.localdomain",nt_host.".mydomain.com",1==1,dns))
| lookup dnslookup clientip as ip outputnew clienthost as dns
| stats count by dns
| fields - count
| rename dns as host]
| eval in_host_list=if(isnull(count),true(),null()),in_splunk=if(isnotnull(count),true(),null())
| append [|inputlookup manual_host_list.csv | fields host | eval in_host_list="True"]
| stats values(*) as * by host
| where isnull(in_host_list) OR isnull(in_splunk)
| search in_host_list=true
| eval splunk_data="No Data"
| table host splunk_data&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To me this is a pretty nasty solution to something that should be relatively simple.&amp;nbsp; I've honestly never spent the time to try and fully understand these searches.&amp;nbsp; They work for us, and they're a mess so i'll leave it be.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 10 Jun 2021 13:03:25 GMT</pubDate>
    <dc:creator>splunk219783</dc:creator>
    <dc:date>2021-06-10T13:03:25Z</dc:date>
    <item>
      <title>LDAP all Hosts and are they Connected?</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555072#M18886</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;I need a query that gives me the following:&lt;/P&gt;&lt;P&gt;All servers in my domain that have not connected to Splunk.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;with someting like this:&amp;nbsp;&lt;BR /&gt;where domain="*" AND Type="*" AND dNSHostName="SEWI*" | rex field=distinguishedName "CN=(?&amp;lt;hostname&amp;gt;[^\,]+).+"&lt;BR /&gt;&lt;BR /&gt;Hope u can help me.&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Thank you in advice,&lt;BR /&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 12:16:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555072#M18886</guid>
      <dc:creator>c_stossek</dc:creator>
      <dc:date>2021-06-09T12:16:40Z</dc:date>
    </item>
    <item>
      <title>Re: LDAP all Hosts and are they Connected?</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555073#M18887</link>
      <description>&lt;P&gt;edit:&lt;BR /&gt;need to see if the Service is not running or the agent isnt even installed on Servers.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Jun 2021 12:17:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555073#M18887</guid>
      <dc:creator>c_stossek</dc:creator>
      <dc:date>2021-06-09T12:17:53Z</dc:date>
    </item>
    <item>
      <title>Re: LDAP all Hosts and are they Connected?</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555302#M18890</link>
      <description>&lt;P&gt;Surprisingly when we had professional services out initially, this was a long and convoluted search.&lt;/P&gt;&lt;P&gt;Ours essentially works like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;A scheduled search writes all ldap assets to a lookup table. Something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| localop | ldapsearch domain="default" search="(objectClass=computer)" attrs="sAMAccountName, distinguishedName, dNSHostName, managedBy"

| rex max_match=5 field=distinguishedName "OU=(?&amp;lt;dn_parsed&amp;gt;[^,]+)" 
| eval category=lower(replace(mvjoin(dn_parsed, "|"), " ", "_"))
| eval priority=case(
   match(category, "domain_controller|exchange|citrix"), "critical", 
   match(category, "server|disabled"), "high", 
   match(category, "workstation|desktop|mobile|laptop"), "medium", 
   match(category, "staging|test"), "low", 
   1==1, "unknown"
)

| eval is_expected=if(priority=="high" OR priority=="critical", "true", "false")
| eval nt_host=replace(sAMAccountName, "\$", "")
| rename dNSHostName AS dns managedBy AS owner

| eval val2lookup = coalesce(dns, nt_host)
| lookup dnslookup clienthost as val2lookup output clientip as ip

| fillnull value="unknown" category, priority, bunit
| table ip,mac,nt_host,dns,owner,priority,lat,long,city,country,bunit,category,pci_domain,is_expected,should_timesync,should_update,requires_av

| dedup nt_host
| outputlookup ldap_assets&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Another search then looks for all hosts in splunk and compares it to the lookup table above.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| tstats count  where index=* OR index=_* NOT host=127.0.0.1 by host index | eval host=lower(host)
| eval host=lower(case(match(host,"\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}"),host,match(host,"mydomain\.com$"),host,1==1,host.".mydomain.com"))
| append [ | inputlookup ldap_assets | makemv delim="|" category | search category=servers | mvexpand category | eval dns=lower(case(dns=="localhost.localdomain",nt_host.".mydomain.com",1==1,dns))
| lookup dnslookup clientip as ip outputnew clienthost as dns
| stats count by dns
| fields - count
| rename dns as host]
| eval in_host_list=if(isnull(count),true(),null()),in_splunk=if(isnotnull(count),true(),null())
| append [|inputlookup manual_host_list.csv | fields host | eval in_host_list="True"]
| stats values(*) as * by host
| where isnull(in_host_list) OR isnull(in_splunk)
| search in_host_list=true
| eval splunk_data="No Data"
| table host splunk_data&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;To me this is a pretty nasty solution to something that should be relatively simple.&amp;nbsp; I've honestly never spent the time to try and fully understand these searches.&amp;nbsp; They work for us, and they're a mess so i'll leave it be.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 10 Jun 2021 13:03:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555302#M18890</guid>
      <dc:creator>splunk219783</dc:creator>
      <dc:date>2021-06-10T13:03:25Z</dc:date>
    </item>
    <item>
      <title>Re: LDAP all Hosts and are they Connected?</title>
      <link>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555457#M18893</link>
      <description>&lt;P&gt;Hi,&lt;BR /&gt;&lt;BR /&gt;Many thanks for the answer,&lt;/P&gt;&lt;P&gt;Unfortunately, the querys doesn't work for me:&lt;BR /&gt;&lt;BR /&gt;Error in 'outputlookup' command: The lookup table 'ldap_assets' is invalid&lt;BR /&gt;&lt;BR /&gt;Is it a Versionproblem?&amp;nbsp;We use Splunk v. 7.3.1&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;Kind regars,&lt;BR /&gt;Thomas&lt;/P&gt;</description>
      <pubDate>Fri, 11 Jun 2021 09:41:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Deployment-Architecture/LDAP-all-Hosts-and-are-they-Connected/m-p/555457#M18893</guid>
      <dc:creator>c_stossek</dc:creator>
      <dc:date>2021-06-11T09:41:44Z</dc:date>
    </item>
  </channel>
</rss>

