<?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: Rename &amp; Lookup in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484292#M135552</link>
    <description>&lt;P&gt;There are a couple of ways to do that.  First, you can't use &lt;CODE&gt;|&lt;/CODE&gt; within &lt;CODE&gt;()&lt;/CODE&gt;.  Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( index=summary_dac_tax partnerId=* tax_year=2018 ofx_appid=tt* error_code_host!=null EIN=*) OR ( index=hds* sourcetype=hdsperf* partner_id=* ein=* tax_year=2018)
| rename ein AS EIN
| lookup ty_18_ein_conflicts.csv EIN
| stats dc(intuit_tid) as total_request dc(eval(if(error_msg_service="OK",intuit_tid,null))) as successful_request by partnerId EIN 
| eval success_rate = round(100*(successful_request/total_request),2)."%"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Fri, 17 Jan 2020 01:29:42 GMT</pubDate>
    <dc:creator>richgalloway</dc:creator>
    <dc:date>2020-01-17T01:29:42Z</dc:date>
    <item>
      <title>Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484290#M135550</link>
      <description>&lt;P&gt;I'm selecting data from two sourcetypes. There is a field in each sourcetype that is the same, but named differently (ie. EIN vs ein). I then want to implement a lookup from a separate csv file, but need to change the name of a column within the csv to map onto one of the EIN fields.&lt;/P&gt;

&lt;P&gt;How do I implement two renames so that all of my EIN have field aliases that are standardized?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( index=summary_dac_tax partnerId=* tax_year=2018 ofx_appid=tt* error_code_host!=null EIN=*) OR ( index=hds* sourcetype=hdsperf* partner_id=* ein=* tax_year=2018 
| rename ein AS EIN) 
[| inputlookup ty_18_ein_conflicts.csv 
| rename ein AS EIN 
| fields EIN] 
| stats dc(intuit_tid) as total_request dc(eval(if(error_msg_service="OK",intuit_tid,null))) as successful_request by partnerId EIN 
| eval success_rate = round(100*(successful_request/total_request),2)."%"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jan 2020 00:13:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484290#M135550</guid>
      <dc:creator>hollybross1219</dc:creator>
      <dc:date>2020-01-17T00:13:44Z</dc:date>
    </item>
    <item>
      <title>Re: Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484291#M135551</link>
      <description>&lt;P&gt;Basically how can I get EIN type of fields to have the same alias so they map together with the lookup properly. Should I use append?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 00:15:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484291#M135551</guid>
      <dc:creator>hollybross1219</dc:creator>
      <dc:date>2020-01-17T00:15:12Z</dc:date>
    </item>
    <item>
      <title>Re: Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484292#M135552</link>
      <description>&lt;P&gt;There are a couple of ways to do that.  First, you can't use &lt;CODE&gt;|&lt;/CODE&gt; within &lt;CODE&gt;()&lt;/CODE&gt;.  Try this.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;( index=summary_dac_tax partnerId=* tax_year=2018 ofx_appid=tt* error_code_host!=null EIN=*) OR ( index=hds* sourcetype=hdsperf* partner_id=* ein=* tax_year=2018)
| rename ein AS EIN
| lookup ty_18_ein_conflicts.csv EIN
| stats dc(intuit_tid) as total_request dc(eval(if(error_msg_service="OK",intuit_tid,null))) as successful_request by partnerId EIN 
| eval success_rate = round(100*(successful_request/total_request),2)."%"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 17 Jan 2020 01:29:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484292#M135552</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-01-17T01:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484293#M135553</link>
      <description>&lt;P&gt;use &lt;CODE&gt;coalesce&lt;/CODE&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; ( index=summary_dac_tax partnerId=* tax_year=2018 ofx_appid=tt* error_code_host!=null EIN=*) OR ( index=hds* sourcetype=hdsperf* partner_id=* ein=* tax_year=2018 )
 |  eval EIN = coalesce(ein, EIN) 
 [| inputlookup ty_18_ein_conflicts.csv 
 | rename ein AS EIN 
 | fields EIN] 
 ....
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, how about this?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 01:35:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484293#M135553</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-17T01:35:52Z</dc:date>
    </item>
    <item>
      <title>Re: Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484294#M135554</link>
      <description>&lt;P&gt;Doesn't work. The &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;EIN&lt;/CODE&gt; after &lt;CODE&gt;| lookup ty_18_ein_conflicts.csv&lt;/CODE&gt; doesn't work. Also, I understand with a .csv file I need inputlookup function&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 16:39:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484294#M135554</guid>
      <dc:creator>hollybross1219</dc:creator>
      <dc:date>2020-01-17T16:39:19Z</dc:date>
    </item>
    <item>
      <title>Re: Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484295#M135555</link>
      <description>&lt;P&gt;tried this and didn't work. Error output is "Error in 'eval' command: The expression is malformed." Doesn't &lt;CODE&gt;coalesce&lt;/CODE&gt; evaluate the value of a field? My problem is changing the alias of the field itself.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 16:45:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484295#M135555</guid>
      <dc:creator>hollybross1219</dc:creator>
      <dc:date>2020-01-17T16:45:42Z</dc:date>
    </item>
    <item>
      <title>Re: Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484296#M135556</link>
      <description>&lt;P&gt;What I settled with:&lt;/P&gt;

&lt;PRE&gt;  
( index=summary_dac_tax partnerId=* tax_year=2018 ofx_appid=tt* error_code_host!=null EIN=*) OR ( index=hds* sourcetype=hdsperf* partner_id=* ein=* tax_year=2018 ) 
| stats dc(intuit_tid) as total_request dc(eval(if(error_msg_service="OK",intuit_tid,null))) as successful_request by partnerId EIN 
| eval success_rate = round(100*(successful_request/total_request),2)."%" 
| rename EIN as ein 
| lookup ty_18_ein_conflicts.csv ein 
| fields partnerId, ein, total_request, successful_request &lt;/PRE&gt;

&lt;P&gt;Follow up question though. The output for this is GIANT. Is there any dedup methods / tricks that aren't already covered in &lt;CODE&gt;stats&lt;/CODE&gt; line? &lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 17:20:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484296#M135556</guid>
      <dc:creator>hollybross1219</dc:creator>
      <dc:date>2020-01-17T17:20:32Z</dc:date>
    </item>
    <item>
      <title>Re: Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484297#M135557</link>
      <description>&lt;P&gt;&lt;CODE&gt;lookup&lt;/CODE&gt; and &lt;CODE&gt;inputlookup&lt;/CODE&gt; are two commands for getting data from lookup files.&lt;/P&gt;

&lt;P&gt;You say EIN  doesn't work.  What error do you get?  What is the correct field name in the CSV file?&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jan 2020 20:15:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484297#M135557</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2020-01-17T20:15:16Z</dc:date>
    </item>
    <item>
      <title>Re: Rename &amp; Lookup</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484298#M135558</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;Error output is "Error in 'eval' command: The expression is malformed."
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This result is not where I described it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Doesn't "coalesce" evaluate the value of a field?
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Yes,  &lt;CODE&gt;coalesce&lt;/CODE&gt;  can alias other field name.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|  eval EIN = coalesce(ein, EIN) 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;As this result, both &lt;CODE&gt;ein&lt;/CODE&gt;  and  &lt;CODE&gt;EIN&lt;/CODE&gt;  is same field &lt;CODE&gt;EIN&lt;/CODE&gt;&lt;BR /&gt;
This order is evaluated in the order of the arguments.&lt;BR /&gt;
If the event has &lt;CODE&gt;ein&lt;/CODE&gt; , the value of  &lt;CODE&gt;ein&lt;/CODE&gt; is entered, otherwise the value of the next &lt;CODE&gt;EIN&lt;/CODE&gt;  is entered.&lt;/P&gt;</description>
      <pubDate>Sat, 18 Jan 2020 00:35:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Rename-Lookup/m-p/484298#M135558</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-01-18T00:35:31Z</dc:date>
    </item>
  </channel>
</rss>

