<?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: Run macro commands from lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Run-macro-commands-from-lookup/m-p/701428#M237930</link>
    <description>&lt;P&gt;That's what i'm finding as well.&amp;nbsp; I'm curious if there's a round-about way to do this.&amp;nbsp; Maybe using that string as a token in a dashboard?&lt;/P&gt;</description>
    <pubDate>Wed, 09 Oct 2024 14:13:04 GMT</pubDate>
    <dc:creator>apiprek2</dc:creator>
    <dc:date>2024-10-09T14:13:04Z</dc:date>
    <item>
      <title>Run macro commands from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Run-macro-commands-from-lookup/m-p/701369#M237909</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;I'm wondering if it's possible to define and execute a macro from a lookup.&amp;nbsp; I have an index with several (about 50) user actions, which aren't named in a user friendly manner.&amp;nbsp; Additionally, each action has different fields, which I'd like to extract using inline rex queries.&amp;nbsp; In short, I'd like a table with the following:&lt;/P&gt;&lt;TABLE border="1" width="120.6193339521025%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="25%" height="24px"&gt;&lt;STRONG&gt;Time&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;&lt;STRONG&gt;UserName&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="89.36781609195403%" height="24px"&gt;&lt;STRONG&gt;Message&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="25%" height="24px"&gt;10:00 a.m.&lt;/TD&gt;&lt;TD width="25%" height="24px"&gt;JohnDoe&lt;/TD&gt;&lt;TD width="89.36781609195403%" height="24px"&gt;This is action1.&amp;nbsp; Details for action1.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10:01 a.m.&lt;/TD&gt;&lt;TD&gt;JohnDoe&lt;/TD&gt;&lt;TD&gt;This is action2.&amp;nbsp; Details for action2.&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD&gt;10:02 a.m.&amp;nbsp;&lt;/TD&gt;&lt;TD&gt;JohnDoe&lt;/TD&gt;&lt;TD&gt;This is action3.&amp;nbsp; Details for action3.&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I know can define a friendly name for the action using a lookup.&amp;nbsp; I can also do the rex field extractions and compose a details field using a macro for each action.&amp;nbsp; However, is there a way to also rex the fields and define the details in a lookup?&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking of creating a lookup like this:&lt;/P&gt;&lt;TABLE border="1" width="125.69341879294156%"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD width="14.246231155778895%" height="24px"&gt;&lt;STRONG&gt;Action&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="24.56107698988771%" height="24px"&gt;&lt;STRONG&gt;FriendlyDescription&lt;/STRONG&gt;&lt;/TD&gt;&lt;TD width="105.637351546959%" height="24px"&gt;&lt;STRONG&gt;MacroDefinition&lt;/STRONG&gt;&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="14.246231155778895%" height="24px"&gt;action1&lt;/TD&gt;&lt;TD width="24.56107698988771%" height="24px"&gt;"This is action1"&lt;/TD&gt;&lt;TD width="105.637351546959%" height="24px"&gt;| rex to extract fields for action1 | eval for Details for action1&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="14.246231155778895%" height="29px"&gt;action2&lt;/TD&gt;&lt;TD width="24.56107698988771%" height="29px"&gt;"This is action2"&lt;/TD&gt;&lt;TD width="105.637351546959%" height="29px"&gt;| rex to extract fields for action2&amp;nbsp;| eval for Details for action2&lt;/TD&gt;&lt;/TR&gt;&lt;TR&gt;&lt;TD width="14.246231155778895%" height="24px"&gt;action3&lt;/TD&gt;&lt;TD width="24.56107698988771%" height="24px"&gt;"This is action3"&lt;/TD&gt;&lt;TD width="105.637351546959%" height="24px"&gt;| rex to extract fields for action3 | eval for Details for action3&lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I was thinking about something like this:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=MyIndex source=MySource

| lookup MyLookup.csv ActionId OUTPUT FriendlyDescription, MacroDefinition

`code to execute MacroDefinition`

|table _time, UserName, FriendlyDescription, Details for action&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm not sure if i'm barking up the wrong tree, but the reason I'd like to do this in one place (a lookup) instead of 50 different macro definitions.&amp;nbsp; It'd be neat to have all the code in one place.&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 04 Nov 2024 21:37:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Run-macro-commands-from-lookup/m-p/701369#M237909</guid>
      <dc:creator>apiprek2</dc:creator>
      <dc:date>2024-11-04T21:37:48Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro commands from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Run-macro-commands-from-lookup/m-p/701378#M237913</link>
      <description>&lt;P&gt;Macros are expanded before the resultant SPL is parsed and executed which probably means that macros stored in a lookup are not expanded.&lt;/P&gt;</description>
      <pubDate>Tue, 08 Oct 2024 23:01:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Run-macro-commands-from-lookup/m-p/701378#M237913</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-10-08T23:01:29Z</dc:date>
    </item>
    <item>
      <title>Re: Run macro commands from lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Run-macro-commands-from-lookup/m-p/701428#M237930</link>
      <description>&lt;P&gt;That's what i'm finding as well.&amp;nbsp; I'm curious if there's a round-about way to do this.&amp;nbsp; Maybe using that string as a token in a dashboard?&lt;/P&gt;</description>
      <pubDate>Wed, 09 Oct 2024 14:13:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Run-macro-commands-from-lookup/m-p/701428#M237930</guid>
      <dc:creator>apiprek2</dc:creator>
      <dc:date>2024-10-09T14:13:04Z</dc:date>
    </item>
  </channel>
</rss>

