<?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 can I replace only the field value if found using Automatic lookups? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194414#M187296</link>
    <description>&lt;P&gt;Hello horst.poehlmann,&lt;/P&gt;

&lt;P&gt;All configuration is stored inside &lt;STRONG&gt;$SPLUNK_HOME/etc//local&lt;/STRONG&gt; on the files &lt;STRONG&gt;props.conf&lt;/STRONG&gt; and &lt;STRONG&gt;transforms.conf&lt;/STRONG&gt; when permissions are "App" or "Global".&lt;/P&gt;

&lt;P&gt;Related to your query, I believe the best thing is to output the IP from the automatic lookup to a new field, something like: &lt;STRONG&gt;src_ip_resolved&lt;/STRONG&gt; and use an &lt;CODE&gt;eval&lt;/CODE&gt; command to define it the &lt;STRONG&gt;src_ip&lt;/STRONG&gt; should be replaced with the content of &lt;STRONG&gt;src_ip_resolved&lt;/STRONG&gt; or not:&lt;/P&gt;

&lt;H4&gt;Example&lt;/H4&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | eval src_ip=IF(ISNULL(src_ip_resolved),src_ip,src_ip_resolved)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On the example above, you initial search should use the automatic lookup definition returning the new field &lt;STRONG&gt;src_ip_resolved&lt;/STRONG&gt;, later you check: IF the lookup result was null, you use the &lt;STRONG&gt;src_ip&lt;/STRONG&gt;, ELSE use &lt;STRONG&gt;src_ip_resolved&lt;/STRONG&gt; instead. You'll need to repeat it for the &lt;STRONG&gt;dest_ip&lt;/STRONG&gt; field as well.&lt;/P&gt;</description>
    <pubDate>Mon, 28 Sep 2020 18:04:59 GMT</pubDate>
    <dc:creator>musskopf</dc:creator>
    <dc:date>2020-09-28T18:04:59Z</dc:date>
    <item>
      <title>How can I replace only the field value if found using Automatic lookups?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194413#M187295</link>
      <description>&lt;P&gt;I have a problem with my checkpoint logs and automatic lookup tables (although the problem is not specific to checkpoint logs but rather automatic lookups).&lt;/P&gt;

&lt;P&gt;The original log lines look something like this:&lt;/P&gt;

&lt;P&gt;loc=1959996|time= 6Nov2014 11:48:49|action=accept|orig=fw|i/f_dir=inbound|i/f_name=Lan1|has_accounting=1|product=VPN-1 &amp;amp; FireWall-1|__policy_id_tag=product=VPN-1 &amp;amp; FireWall-1[db_tag={999999999-63E0-11E4-8888-999999999999};mgmt=cpmgr;date=1415077659;policy_name=POL1]|service_id=domain-udp|src=SERVER1|s_port=64444|dst=DESTSERV1|service=domain-udp|proto=udp|rule=77&lt;/P&gt;

&lt;P&gt;loc=1960000|time= 6Nov2014 11:48:49|action=accept|orig=fw|i/f_dir=inbound|i/f_name=Lan2|has_accounting=1|product=VPN-1 &amp;amp; FireWall-1|__policy_id_tag=product=VPN-1 &amp;amp; FireWall-1[db_tag={999999999-63E0-11E4-8888-999999999999};mgmt=cpmgr;date=1415077659;policy_name=POL1]|service_id=https|src=10.0.0.1|s_port=55555|dst=10.1.0.1|service=https|proto=tcp|rule=222&lt;/P&gt;

&lt;P&gt;When splunk creates the fields, I end up with src=SERVER1 and src_ip=SERVER1 (same for dest and dest_ip)&lt;/P&gt;

&lt;P&gt;What I want to do is replace src_ip with the actual IP of SERVER1, so I created a csv from the checkpoint config (using CPrules.pl) and that all works fine. &lt;/P&gt;

&lt;P&gt;However, there are also lines that are not defined and therefore already contain an IP address (see logline 2 above), which means it can't find it in the lookup table and therefore returns a blank field. I use the "Overwrite field values" feature in automatic lookups.&lt;/P&gt;

&lt;P&gt;My Question is, can I somehow keep the original value if it wasn't found in the lookup table?&lt;/P&gt;

&lt;P&gt;Also, when defining lookups in the Web GUI, where is the information stored?&lt;/P&gt;

&lt;P&gt;PS: I use splunk 6.1&lt;/P&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:04:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194413#M187295</guid>
      <dc:creator>horst_poehlmann</dc:creator>
      <dc:date>2020-09-28T18:04:57Z</dc:date>
    </item>
    <item>
      <title>Re: How can I replace only the field value if found using Automatic lookups?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194414#M187296</link>
      <description>&lt;P&gt;Hello horst.poehlmann,&lt;/P&gt;

&lt;P&gt;All configuration is stored inside &lt;STRONG&gt;$SPLUNK_HOME/etc//local&lt;/STRONG&gt; on the files &lt;STRONG&gt;props.conf&lt;/STRONG&gt; and &lt;STRONG&gt;transforms.conf&lt;/STRONG&gt; when permissions are "App" or "Global".&lt;/P&gt;

&lt;P&gt;Related to your query, I believe the best thing is to output the IP from the automatic lookup to a new field, something like: &lt;STRONG&gt;src_ip_resolved&lt;/STRONG&gt; and use an &lt;CODE&gt;eval&lt;/CODE&gt; command to define it the &lt;STRONG&gt;src_ip&lt;/STRONG&gt; should be replaced with the content of &lt;STRONG&gt;src_ip_resolved&lt;/STRONG&gt; or not:&lt;/P&gt;

&lt;H4&gt;Example&lt;/H4&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search&amp;gt; | eval src_ip=IF(ISNULL(src_ip_resolved),src_ip,src_ip_resolved)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;On the example above, you initial search should use the automatic lookup definition returning the new field &lt;STRONG&gt;src_ip_resolved&lt;/STRONG&gt;, later you check: IF the lookup result was null, you use the &lt;STRONG&gt;src_ip&lt;/STRONG&gt;, ELSE use &lt;STRONG&gt;src_ip_resolved&lt;/STRONG&gt; instead. You'll need to repeat it for the &lt;STRONG&gt;dest_ip&lt;/STRONG&gt; field as well.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 18:04:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194414#M187296</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2020-09-28T18:04:59Z</dc:date>
    </item>
    <item>
      <title>Re: How can I replace only the field value if found using Automatic lookups?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194415#M187297</link>
      <description>&lt;P&gt;I could not find any of the variables I used in my lookup definitions using the GUI in the files under $SPLUNK_HOME. I grep'd for a particular string.  Not that important at this stage though.&lt;/P&gt;

&lt;P&gt;Thanks, the eval function did the trick. Not sure how efficient that is as I had to use 4 separate eval functions (src, dest port and protocol), but it does work.&lt;/P&gt;

&lt;P&gt;Appreciate your answer.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2014 03:52:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194415#M187297</guid>
      <dc:creator>horst_poehlmann</dc:creator>
      <dc:date>2014-11-10T03:52:28Z</dc:date>
    </item>
    <item>
      <title>Re: How can I replace only the field value if found using Automatic lookups?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194416#M187298</link>
      <description>&lt;P&gt;That's good! Eval functions like those ones, with a simple IF are very light... you can use the "JOB -&amp;gt; Inspect" panel to have a look how much time they take to run.&lt;/P&gt;</description>
      <pubDate>Mon, 10 Nov 2014 03:55:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-can-I-replace-only-the-field-value-if-found-using-Automatic/m-p/194416#M187298</guid>
      <dc:creator>musskopf</dc:creator>
      <dc:date>2014-11-10T03:55:20Z</dc:date>
    </item>
  </channel>
</rss>

