<?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: Splunk Support for Active Directory: Is it possible to pass a variable in to ldapsearch? in All Apps and Add-ons</title>
    <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147870#M13159</link>
    <description>&lt;P&gt;I managed to resolve the error with &lt;CODE&gt;ldapfilter&lt;/CODE&gt; using the following search: &lt;CODE&gt;info login source=audittrail user=* (action="login attempt" AND info="succeeded" AND host=SEARCH_HEAD AND user~="admin") | eval ID=user | table ID, cn, department | ldapfilter domain=default search="(samAccountName=$ID$)" attrs="cn, department"&lt;/CODE&gt;. &lt;/P&gt;</description>
    <pubDate>Mon, 23 Feb 2015 20:07:43 GMT</pubDate>
    <dc:creator>IngloriousSplun</dc:creator>
    <dc:date>2015-02-23T20:07:43Z</dc:date>
    <item>
      <title>Splunk Support for Active Directory: Is it possible to pass a variable in to ldapsearch?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147867#M13156</link>
      <description>&lt;P&gt;I have a requirement to display an LDAP user's common name and department within a table that also displays their login statistics for Splunk.  My original thought process was to use a subsearch where I collected the user login info, and then have a main search, in this case using &lt;CODE&gt;ldapsearch&lt;/CODE&gt;, where I would pass the users to determine their CN and Department.  It seems as though I can't actually pass in a variable to &lt;CODE&gt;ldapsearch&lt;/CODE&gt;, or I'm getting an unexpected result that it doesn't like because I get empty results.  The search string I'm using is the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ldapsearch domain=DOMAIN search="(samAccountName=$user$)" attrs="cn,department" | append [search info login source=audittrail user=* (action="login attempt" AND info="succeeded" AND host="SEARCH-HEAD" AND user!="admin")] | stats count(action) AS "Total Logins", values(cn) AS "Full Name", values(department) AS "Organization" | sort -"Total Logins"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If I replace the &lt;CODE&gt;$user$&lt;/CODE&gt; with an actual username, the above works.  I've also tried using &lt;CODE&gt;ldapfilter&lt;/CODE&gt;, which works, however, it reports an error that states &lt;/P&gt;

&lt;BLOCKQUOTE&gt;
&lt;P&gt;[Indexer-Peer-A] External search command 'ldapfilter' returned error code 1.  Script output = " ERROR The default configuration stanza for ldap.conf is missing.&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;

&lt;P&gt;I have tried installing the SA-ldapsearch add-on to the indexers and configuring ldap.conf, and I've also tried adding in the "host" and "port" attributes in the normal openldap ldap.conf file.  I can't get that error to disappear.  Despite that, using &lt;CODE&gt;ldapfilter&lt;/CODE&gt; works perfect and returns the results I expect.  I would use this method provided I can get the errors to go away.&lt;/P&gt;

&lt;P&gt;Thoughts?&lt;/P&gt;

&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 17:22:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147867#M13156</guid>
      <dc:creator>IngloriousSplun</dc:creator>
      <dc:date>2015-02-20T17:22:30Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Support for Active Directory: Is it possible to pass a variable in to ldapsearch?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147868#M13157</link>
      <description>&lt;P&gt;I am curious if it is the same issue I encountered. Try this...&lt;/P&gt;

&lt;P&gt;Put in and eval statement after your user search &lt;STRONG&gt;| eval ID=user&lt;/STRONG&gt;    &lt;/P&gt;

&lt;P&gt;change samaccount to look at the new field.&lt;BR /&gt;&lt;BR /&gt;
&lt;STRONG&gt;(samAccountName=$ID$)&lt;/STRONG&gt;  &lt;/P&gt;

&lt;P&gt;I suspect that the token is not getting properly passed to the pipeline because of some data issues.  &lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;EDIT&lt;/STRONG&gt;&lt;BR /&gt;
It looks like |eval ID= was a red herring. I worked my search and simple added  &lt;STRONG&gt;| table user&lt;/STRONG&gt;   prior to the | ldapfilter and things work ok. &lt;/P&gt;

&lt;P&gt;I am going to open up a ticket now and maybe I can't have it solved before summer gets here. &lt;/P&gt;</description>
      <pubDate>Fri, 20 Feb 2015 23:24:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147868#M13157</guid>
      <dc:creator>MartinMcNutt</dc:creator>
      <dc:date>2015-02-20T23:24:52Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Support for Active Directory: Is it possible to pass a variable in to ldapsearch?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147869#M13158</link>
      <description>&lt;P&gt;Thanks for the update, I managed to resolve the error with &lt;CODE&gt;ldapfilter&lt;/CODE&gt; using the following search: &lt;CODE&gt;info login source=audittrail user=* (action="login attempt" AND info="succeeded" AND host=SEARCH_HEAD AND user~="admin") | eval ID=user | table ID, cn, department | ldapfilter domain=default search="(samAccountName=$ID$)" attrs="cn, department"&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Thanks for that tip!&lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2015 19:39:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147869#M13158</guid>
      <dc:creator>IngloriousSplun</dc:creator>
      <dc:date>2015-02-23T19:39:06Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Support for Active Directory: Is it possible to pass a variable in to ldapsearch?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147870#M13159</link>
      <description>&lt;P&gt;I managed to resolve the error with &lt;CODE&gt;ldapfilter&lt;/CODE&gt; using the following search: &lt;CODE&gt;info login source=audittrail user=* (action="login attempt" AND info="succeeded" AND host=SEARCH_HEAD AND user~="admin") | eval ID=user | table ID, cn, department | ldapfilter domain=default search="(samAccountName=$ID$)" attrs="cn, department"&lt;/CODE&gt;. &lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2015 20:07:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147870#M13159</guid>
      <dc:creator>IngloriousSplun</dc:creator>
      <dc:date>2015-02-23T20:07:43Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk Support for Active Directory: Is it possible to pass a variable in to ldapsearch?</title>
      <link>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147871#M13160</link>
      <description>&lt;P&gt;That is awesome.... I do have a ticket open with Splunk to figure out why sa-ldapsearch is doing that. &lt;/P&gt;

&lt;P&gt;Just remember if you plan on putting that into a dashboard, you may have to hide the LDAP part in a macro to avoid Splunk thinking it is a dashboard token.  That one caught me by surprise.  Doing dashboards / reports is not my full time job. &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt; &lt;/P&gt;</description>
      <pubDate>Mon, 23 Feb 2015 22:19:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/All-Apps-and-Add-ons/Splunk-Support-for-Active-Directory-Is-it-possible-to-pass-a/m-p/147871#M13160</guid>
      <dc:creator>MartinMcNutt</dc:creator>
      <dc:date>2015-02-23T22:19:24Z</dc:date>
    </item>
  </channel>
</rss>

