<?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: Cannot Call A Search Command from Search Macro in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370695#M109098</link>
    <description>&lt;P&gt;You are completely correct Micah. Thank you!!!&lt;/P&gt;

&lt;P&gt;Final answers:&lt;BR /&gt;
Search Macro: " ldapsearch ....." (Note no |)&lt;BR /&gt;
Use of search macro: " | {SearchMacroName} " (Note |)&lt;/P&gt;

&lt;P&gt;Thank you all!!!&lt;/P&gt;</description>
    <pubDate>Thu, 08 Feb 2018 20:15:59 GMT</pubDate>
    <dc:creator>spraus</dc:creator>
    <dc:date>2018-02-08T20:15:59Z</dc:date>
    <item>
      <title>Cannot Call A Search Command from Search Macro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370690#M109093</link>
      <description>&lt;P&gt;Hello everyone;&lt;/P&gt;

&lt;P&gt;I am trying to call a search command from a search macro. Does anyone have a suggestion.&lt;BR /&gt;
Example:&lt;BR /&gt;
Typical Search String: | ldapsearch search="(&amp;amp;(objectClass=user)(!(objectClass=computer)))"&lt;BR /&gt;
Search Macro: | ldapsearch search="(&amp;amp;(objectClass=user)(!(objectClass=computer)))" $filter$&lt;/P&gt;

&lt;P&gt;When I run this it is as if 'ldapsearch' is not executed as the search returns way too quick as compared to the raw search.&lt;/P&gt;

&lt;P&gt;Thank you in advance;&lt;BR /&gt;
SPraus&lt;/P&gt;

&lt;P&gt;Edit:&lt;BR /&gt;
Exact "Actual" Macro:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| ldapsearch search="(&amp;amp;(objectClass=user)(!(objectClass=computer)))" attrs="cn,sAMAccountName,mail,department,displayName,canonicalName,objectCategory,l,memberOf,pwdLastSet,sAMAccountType,title,givenName,sn,info,comment,userAccountControl,lastLogon" | rex field=memberOf "CN=(?&amp;lt;groups&amp;gt;.*?),OU=" | strcat "Info: " info "::" "Comment: " comment infoComments | makemv delim="::" infoComments | makemv delim=";" duoAliases | makemv delim="/" canonicalName | eval container = mvindex(canonicalName, 1) | search $filter$
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I have tested with just simply the start as I suggested above.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 19:48:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370690#M109093</guid>
      <dc:creator>spraus</dc:creator>
      <dc:date>2018-02-08T19:48:09Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Call A Search Command from Search Macro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370691#M109094</link>
      <description>&lt;P&gt;The &lt;CODE&gt;ldapsearch&lt;/CODE&gt; command is a generating command, which means it must always be preceded by a &lt;CODE&gt;|&lt;/CODE&gt; (pipe) character. When generating commands are used in macros, you can't put the pipe inside the macro, so you'll need to ensure your search query always contains a pipe immediately before the macro on your search line. So if your macro is named &lt;CODE&gt;ldap_macro&lt;/CODE&gt;, then you can't do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;`ldap_macro` | whatever else...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Instead, you must always do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| `ldap_macro` | whatever else...
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 19:56:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370691#M109094</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-08T19:56:06Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Call A Search Command from Search Macro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370692#M109095</link>
      <description>&lt;P&gt;Specifically you just can't &lt;EM&gt;start&lt;/EM&gt; a macro with a pipe.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:00:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370692#M109095</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-02-08T20:00:16Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Call A Search Command from Search Macro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370693#M109096</link>
      <description>&lt;P&gt;My apologies elliotproebstel... My macro does include the "| ldapsearch  " as you suggest. I forgot to add it above and will edit it. Unfortunately even with the | it is still not returning any results. My exact macro will now be added to the edit.&lt;/P&gt;

&lt;P&gt;Sorry about that;&lt;BR /&gt;
Stephen&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:06:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370693#M109096</guid>
      <dc:creator>spraus</dc:creator>
      <dc:date>2018-02-08T20:06:46Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Call A Search Command from Search Macro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370694#M109097</link>
      <description>&lt;P&gt;I think he's saying your macro needs to look like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[&amp;lt;macro name&amp;gt;]
search = ldapsearch ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And you would do this in your search string:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| `&amp;lt;macro name&amp;gt;`
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:13:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370694#M109097</guid>
      <dc:creator>micahkemp</dc:creator>
      <dc:date>2018-02-08T20:13:03Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Call A Search Command from Search Macro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370695#M109098</link>
      <description>&lt;P&gt;You are completely correct Micah. Thank you!!!&lt;/P&gt;

&lt;P&gt;Final answers:&lt;BR /&gt;
Search Macro: " ldapsearch ....." (Note no |)&lt;BR /&gt;
Use of search macro: " | {SearchMacroName} " (Note |)&lt;/P&gt;

&lt;P&gt;Thank you all!!!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 20:15:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370695#M109098</guid>
      <dc:creator>spraus</dc:creator>
      <dc:date>2018-02-08T20:15:59Z</dc:date>
    </item>
    <item>
      <title>Re: Cannot Call A Search Command from Search Macro</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370696#M109099</link>
      <description>&lt;P&gt;Yes, thanks for correcting and clarifying!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Feb 2018 22:11:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Cannot-Call-A-Search-Command-from-Search-Macro/m-p/370696#M109099</guid>
      <dc:creator>elliotproebstel</dc:creator>
      <dc:date>2018-02-08T22:11:19Z</dc:date>
    </item>
  </channel>
</rss>

