<?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 macro in search string in Knowledge Management</title>
    <link>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330173#M2829</link>
    <description>&lt;P&gt;Still not working. How should I call the macro in search? Is that like?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=* auth("10.20.30.40")&lt;/CODE&gt; and back ticks in the beginning &amp;amp; ending of auth("10.20.30.40"). ?&lt;/P&gt;</description>
    <pubDate>Tue, 31 Oct 2017 22:23:20 GMT</pubDate>
    <dc:creator>karthikmalla</dc:creator>
    <dc:date>2017-10-31T22:23:20Z</dc:date>
    <item>
      <title>Splunk macro in search string</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330171#M2827</link>
      <description>&lt;P&gt;I created a Macro with name &lt;CODE&gt;auth(1)&lt;/CODE&gt;, app is &lt;CODE&gt;ES&lt;/CODE&gt;, argument is &lt;CODE&gt;src&lt;/CODE&gt; and the definition is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| from datamodel:"Authentication"."Authentication" | search (src="$src$" OR Authentication.src="$src$" OR dest="$src$" OR Authentication.dest="$src$") | eval username=user_first+" "+user_last | eval phone=if(isnull(user_phone), user_phone2, user_phone) | rename user_managedBy as userid, user_email as email, WorkstationName as workstation | fields username, email, userid, phone, workstation
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;And I am trying to call this Macro in a ES search as&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=*someexamplesourcetype* auth(src)&lt;/CODE&gt; and this didn't work&lt;/P&gt;

&lt;P&gt;I also tried like&lt;BR /&gt;
&lt;CODE&gt;sourcetype=*someexamplesourcetype* auth("10.20.30.40")&lt;/CODE&gt; and this didn't work too&lt;BR /&gt;
&lt;CODE&gt;sourcetype=*someexamplesourcetype* auth(1)&lt;/CODE&gt; and this didn't work too&lt;/P&gt;

&lt;P&gt;When I try like&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=*someexamplesourcetype* auth&lt;/CODE&gt; I am getting error message as &lt;/P&gt;

&lt;P&gt;Error in 'SearchParser': The search specifies a macro 'auth' that cannot be found. Reasons include: the macro name is misspelled, you do not have "read" permission for the macro, or the macro has not been shared with this application. Click Settings, Advanced search, Search Macros to view macro information.&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Note&lt;/STRONG&gt; There are backticks in front of &lt;CODE&gt;auth&lt;/CODE&gt; and &lt;CODE&gt;auth(src)&lt;/CODE&gt; as you know this will be converted to code format I removed backticks in this question.&lt;/P&gt;

&lt;P&gt;I assigned the Macro access to global with read &amp;amp; write for everyone, still the error message appears.&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 03:47:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330171#M2827</guid>
      <dc:creator>karthikmalla</dc:creator>
      <dc:date>2017-10-31T03:47:22Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk macro in search string</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330172#M2828</link>
      <description>&lt;P&gt;Hi @karthikmalla,&lt;/P&gt;

&lt;P&gt;I think you need to make it Global and read permission is needed for the macro.  I can see one issue with the defination of your macro, you need to remove first "I" from the macro defination.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;from datamodel:"Authentication"."Authentication" | search (src="$src$" OR Authentication.src="$src$" OR dest="$src$" OR Authentication.dest="$src$") | eval username=user_first+" "+user_last | eval phone=if(isnull(user_phone), user_phone2, user_phone) | rename user_managedBy as userid, user_email as email, WorkstationName as workstation | fields username, email, userid, phone, workstation
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 31 Oct 2017 10:40:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330172#M2828</guid>
      <dc:creator>hardikJsheth</dc:creator>
      <dc:date>2017-10-31T10:40:04Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk macro in search string</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330173#M2829</link>
      <description>&lt;P&gt;Still not working. How should I call the macro in search? Is that like?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;sourcetype=* auth("10.20.30.40")&lt;/CODE&gt; and back ticks in the beginning &amp;amp; ending of auth("10.20.30.40"). ?&lt;/P&gt;</description>
      <pubDate>Tue, 31 Oct 2017 22:23:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330173#M2829</guid>
      <dc:creator>karthikmalla</dc:creator>
      <dc:date>2017-10-31T22:23:20Z</dc:date>
    </item>
    <item>
      <title>Re: Splunk macro in search string</title>
      <link>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330174#M2830</link>
      <description>&lt;P&gt;You forgot to embed the macro into the ` ` characters.&lt;BR /&gt;
Like this: &lt;BR /&gt;
&lt;STRONG&gt;`auth(src)`&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;PS: Yes, I know this is a really delayed answer and the problem most likely has already been solved. Just a help for users having with a similar issue.&lt;/P&gt;</description>
      <pubDate>Sun, 29 Sep 2019 16:31:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Knowledge-Management/Splunk-macro-in-search-string/m-p/330174#M2830</guid>
      <dc:creator>romanwaldecker</dc:creator>
      <dc:date>2019-09-29T16:31:15Z</dc:date>
    </item>
  </channel>
</rss>

