<?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 replace values without using a join in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333741#M99242</link>
    <description>&lt;P&gt;Brill - Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Thu, 27 Jul 2017 10:44:19 GMT</pubDate>
    <dc:creator>robertlynch2020</dc:creator>
    <dc:date>2017-07-27T10:44:19Z</dc:date>
    <item>
      <title>How to replace values without using a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333737#M99238</link>
      <description>&lt;P&gt;I am using a join, but is there a better way to replace values?&lt;/P&gt;

&lt;P&gt;I have the following table. (NICKNAME + Human_Name_Nickname are the headers)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;NICKNAME    Human_Name_Nickname
mx  MX_BASIC
smcrisk_engine  RISK_ENGINE
mxtraderepository_engine    MX_TRADE_REPO_ENGINE
smcobjectrepository_engine  SM_ENGINE
mxmlexchange_mxtaskxa   MXMLEXCHANGE
mxdealscanner_engine    DEAL_SCANNER
mx_cesar    CESAR
mx_marketdata_repository_engine MARKET_DATA
mxprocessingscript  PROCESSING_SCRIPT
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I am retriving back thousands of lines of data with NICKNAME, i want to replace values from the lookup table.&lt;BR /&gt;
E.G find "mx" and replace it with "MX_BASIC" etc.. so lots of entries. Then find "smcrisk_engine" and replace it with  "RISK_ENGINE" if no match use the original value.&lt;/P&gt;

&lt;P&gt;This is what i have- But i have been told not to use joins...can i do this better?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| join  NICKNAME type=left [inputlookup TEST_MXTIMING_NICKNAME.csv  ] | fillnull Human_Name_Nickname | eval Human_Name_Nickname=if(Human_Name_Nickname=0,$$NICKNAME$$,Human_Name_Nickname) | rename Human_Name_Nickname AS NICKNAME.
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This works, but i am concerned of performance.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:04:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333737#M99238</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2020-09-29T15:04:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace values without using a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333738#M99239</link>
      <description>&lt;P&gt;Joins do not perform well so it's a good idea to avoid them.  What you are trying to do seem pretty straightforward and can easily be done without a join.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;your search that returns events with NICKNAME field&amp;gt; | lookup TEST_MXTIMING_NICKNAME.csv NICKNAME OUTPUT Human_Name_Nickname | eval NICKNAME=coalesce(Human_Name_Nickname,NICKNAME) | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This query searches the lookup file for the given NICKNAME and returns the associates Human_Name_Nickname.  The &lt;CODE&gt;coalesce&lt;/CODE&gt; statement sets NICKNAME to the value if Human_Name_Nickname if it is not null, otherwise it's set to itself.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:03:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333738#M99239</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-09-29T15:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace values without using a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333739#M99240</link>
      <description>&lt;P&gt;Hi  robertlynch2020,&lt;BR /&gt;
lookup command is a left join so you can write something like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| lookup TEST_MXTIMING_NICKNAME.csv NICKNAME OUTPUT other_lookup_fields
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if the  NICKNAME field is different between search and lookup, you can write&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your_search
| lookup TEST_MXTIMING_NICKNAME.csv NICKNAME AS different_NICK_NAME OUTPUT other_lookup_fields
| ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Bye.&lt;/P&gt;

&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 26 Jul 2017 13:01:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333739#M99240</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-07-26T13:01:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace values without using a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333740#M99241</link>
      <description>&lt;P&gt;Instead do this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | lookup TEST_MXTIMING_NICKNAME NICKNAME
| eval NICKNAME=coalesce(Human_Name_Nickname, NICKNAME)
| fields - Human_Name_Nickname
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 26 Jul 2017 14:08:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333740#M99241</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-07-26T14:08:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace values without using a join</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333741#M99242</link>
      <description>&lt;P&gt;Brill - Cheers &lt;span class="lia-unicode-emoji" title=":slightly_smiling_face:"&gt;🙂&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 27 Jul 2017 10:44:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-values-without-using-a-join/m-p/333741#M99242</guid>
      <dc:creator>robertlynch2020</dc:creator>
      <dc:date>2017-07-27T10:44:19Z</dc:date>
    </item>
  </channel>
</rss>

