<?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 Metadata token inside macro in Splunk Enterprise</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise/Metadata-token-inside-macro/m-p/760513#M24176</link>
    <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a requirement where I need to have the name of the current running saved search available to itself. And to avoid human error, I am looking for an automated way of doing this.&lt;/P&gt;&lt;P&gt;Based on &lt;A href="https://community.splunk.com/t5/Reporting/Any-way-to-get-the-name-of-the-scheduled-search-you-are-in/m-p/351120" target="_blank" rel="noopener"&gt;this question&lt;/A&gt;, I can use &lt;STRONG&gt;| eval search_name="$name$"&lt;/STRONG&gt; and it works fine, but I was looking into a way of putting that inside a macro. Unfortunately, when doing that, search_name ends up with the literal value "$name$".&lt;/P&gt;&lt;P&gt;Is anyone doing something similar and has a solution?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
    <pubDate>Tue, 28 Apr 2026 06:58:49 GMT</pubDate>
    <dc:creator>akai</dc:creator>
    <dc:date>2026-04-28T06:58:49Z</dc:date>
    <item>
      <title>Metadata token inside macro</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Metadata-token-inside-macro/m-p/760513#M24176</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;I have a requirement where I need to have the name of the current running saved search available to itself. And to avoid human error, I am looking for an automated way of doing this.&lt;/P&gt;&lt;P&gt;Based on &lt;A href="https://community.splunk.com/t5/Reporting/Any-way-to-get-the-name-of-the-scheduled-search-you-are-in/m-p/351120" target="_blank" rel="noopener"&gt;this question&lt;/A&gt;, I can use &lt;STRONG&gt;| eval search_name="$name$"&lt;/STRONG&gt; and it works fine, but I was looking into a way of putting that inside a macro. Unfortunately, when doing that, search_name ends up with the literal value "$name$".&lt;/P&gt;&lt;P&gt;Is anyone doing something similar and has a solution?&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you&lt;/P&gt;</description>
      <pubDate>Tue, 28 Apr 2026 06:58:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Metadata-token-inside-macro/m-p/760513#M24176</guid>
      <dc:creator>akai</dc:creator>
      <dc:date>2026-04-28T06:58:49Z</dc:date>
    </item>
    <item>
      <title>Re: Metadata token inside macro</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise/Metadata-token-inside-macro/m-p/760792#M24232</link>
      <description>&lt;P&gt;Hello&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/311626"&gt;@akai&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;The issue is $name$ inside the macro is no longer a token its more of a macro parameter.&lt;BR /&gt;&lt;BR /&gt;In order to fix you need to pass $name$ as a macro argument from the saved search itself.&lt;BR /&gt;&lt;BR /&gt;Define your macro to accept the search name as an argument — e.g., my_macro(1) with argument search_name. And macro definition would be something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[my_macro(1)]
args = search_name
definition = eval search_name=$search_name|s$&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then you can call the macro like this:&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;.....
| `my_macro($name$)`
| table search_name&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;&lt;BR /&gt;I hope this helps!!!&lt;/P&gt;</description>
      <pubDate>Fri, 08 May 2026 05:59:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise/Metadata-token-inside-macro/m-p/760792#M24232</guid>
      <dc:creator>VatsalJagani</dc:creator>
      <dc:date>2026-05-08T05:59:13Z</dc:date>
    </item>
  </channel>
</rss>

