<?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: how to insert a macro name as field value if the results on the search match to a macro? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-insert-a-macro-name-as-field-value-if-the-results-on-the/m-p/480776#M134707</link>
    <description>&lt;P&gt;Hi pavanae,&lt;/P&gt;

&lt;P&gt;If I understand it correctly then you don't match on the macro command &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  `macroNameHere`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but just on the string of the name like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | eval macro_match= case(searchmatch("macro_1"),"macro_1", searchmatch("macro_2"),"macro_2", true(), "None")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you intend to call and run a macro this way, I don't think that is possible out of the box ... but might be wrong on that for the latest version of Splunk &lt;CODE&gt;¯\_(ツ)_/¯&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
    <pubDate>Wed, 08 Jan 2020 20:01:48 GMT</pubDate>
    <dc:creator>MuS</dc:creator>
    <dc:date>2020-01-08T20:01:48Z</dc:date>
    <item>
      <title>how to insert a macro name as field value if the results on the search match to a macro?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-insert-a-macro-name-as-field-value-if-the-results-on-the/m-p/480775#M134706</link>
      <description>&lt;P&gt;I have a query which displays some statistical results. Now I want to add a column macro_match which contains the matching macro. &lt;/P&gt;

&lt;P&gt;like as shown below &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;macro_match
macro_1
macro_2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is it possible in splunk ?&lt;/P&gt;

&lt;P&gt;I tried using the searchmatch and inserted the macro in it instead of the search string as shown below which doesn't worked. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| eval macro_match= case(searchmatch("`macro_1`"),"macro_1", searchmatch("`macro_2`"),"macro_2", true(), "None")
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 Jan 2020 19:45:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-insert-a-macro-name-as-field-value-if-the-results-on-the/m-p/480775#M134706</guid>
      <dc:creator>pavanae</dc:creator>
      <dc:date>2020-01-08T19:45:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to insert a macro name as field value if the results on the search match to a macro?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-insert-a-macro-name-as-field-value-if-the-results-on-the/m-p/480776#M134707</link>
      <description>&lt;P&gt;Hi pavanae,&lt;/P&gt;

&lt;P&gt;If I understand it correctly then you don't match on the macro command &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  `macroNameHere`
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;but just on the string of the name like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;  | eval macro_match= case(searchmatch("macro_1"),"macro_1", searchmatch("macro_2"),"macro_2", true(), "None")
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If you intend to call and run a macro this way, I don't think that is possible out of the box ... but might be wrong on that for the latest version of Splunk &lt;CODE&gt;¯\_(ツ)_/¯&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Hope this helps ...&lt;/P&gt;

&lt;P&gt;cheers, MuS&lt;/P&gt;</description>
      <pubDate>Wed, 08 Jan 2020 20:01:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-insert-a-macro-name-as-field-value-if-the-results-on-the/m-p/480776#M134707</guid>
      <dc:creator>MuS</dc:creator>
      <dc:date>2020-01-08T20:01:48Z</dc:date>
    </item>
  </channel>
</rss>

