<?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: pass field value in search as an argument to be used in a macro in Splunk Enterprise Security</title>
    <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453034#M6351</link>
    <description>&lt;P&gt;Glad it helped. Pls vote to accept the comment/answers and also post your answers for future readers.&lt;/P&gt;</description>
    <pubDate>Thu, 28 Mar 2019 12:03:25 GMT</pubDate>
    <dc:creator>lakshman239</dc:creator>
    <dc:date>2019-03-28T12:03:25Z</dc:date>
    <item>
      <title>pass field value in search as an argument to be used in a macro</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453031#M6348</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;I am trying to figure out how to pass a field value in the search to a macro which interprets it and does further processing through a lookup table.&lt;/P&gt;

&lt;P&gt;I have consulted multiple threads but due to karma cannot link to them. Currently my approach is as follows:&lt;/P&gt;

&lt;P&gt;Search&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index my_custom_field="the_value_to_filter_for" | map search="|`my_processing_macro($my_custom_field_)`"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Macro: my_processing_macro(1) (argument defined as name)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lookup my_lookup_table_def $name$ as lookup_table_column1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Lookup table (CSV-format): linked to lookup table definition&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lookup_table_column1,lookup_table_column2
value_i_pass_in_macro, value_i_want_returned
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So in short, the value I pass in my_custom_field corresponds to a column1 row in the lookup table. Basically column 2 contains the regex or other macro's to expand during processing.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 23:47:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453031#M6348</guid>
      <dc:creator>hexerino</dc:creator>
      <dc:date>2020-09-29T23:47:23Z</dc:date>
    </item>
    <item>
      <title>Re: pass field value in search as an argument to be used in a macro</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453032#M6349</link>
      <description>&lt;P&gt;The  below search should work .. are you seeing any errors? You need $$ and test your macros by using both &lt;CODE&gt;|&lt;/CODE&gt;yourmacro(1)`  pipe and without pipe and adjust&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=my_index my_custom_field="the_value_to_filter_for" | map search=" search `my_processing_macro($my_custom_field$)`"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 26 Mar 2019 11:13:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453032#M6349</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-03-26T11:13:10Z</dc:date>
    </item>
    <item>
      <title>Re: pass field value in search as an argument to be used in a macro</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453033#M6350</link>
      <description>&lt;P&gt;After long deliberation we decided to adopt a different filtering strategy. This method worked after some alteration. Thank you for your suggestion !&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 10:26:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453033#M6350</guid>
      <dc:creator>hexerino</dc:creator>
      <dc:date>2019-03-28T10:26:02Z</dc:date>
    </item>
    <item>
      <title>Re: pass field value in search as an argument to be used in a macro</title>
      <link>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453034#M6351</link>
      <description>&lt;P&gt;Glad it helped. Pls vote to accept the comment/answers and also post your answers for future readers.&lt;/P&gt;</description>
      <pubDate>Thu, 28 Mar 2019 12:03:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Enterprise-Security/pass-field-value-in-search-as-an-argument-to-be-used-in-a-macro/m-p/453034#M6351</guid>
      <dc:creator>lakshman239</dc:creator>
      <dc:date>2019-03-28T12:03:25Z</dc:date>
    </item>
  </channel>
</rss>

