<?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: Bulk rename of all fields that come from calling &amp;quot;| lookup&amp;quot;? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378507#M110948</link>
    <description>&lt;P&gt;I had issue with this. it seems to take  the &lt;CODE&gt;_* fields&lt;/CODE&gt; as part of the &lt;CODE&gt;*&lt;/CODE&gt; on the first &lt;CODE&gt;rename&lt;/CODE&gt;.&lt;/P&gt;</description>
    <pubDate>Thu, 25 Apr 2019 18:33:52 GMT</pubDate>
    <dc:creator>theady</dc:creator>
    <dc:date>2019-04-25T18:33:52Z</dc:date>
    <item>
      <title>Bulk rename of all fields that come from calling "| lookup"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378504#M110945</link>
      <description>&lt;P&gt;We have a CMDB lookup that adds 100 fields when we do not specify a limited set with "OUTPUT".  More fields are added every now and then.  I cannot rename the fields in the file because too many people share this file; it is what it is.  Is there a flexible way to rename all fields that are in there that will still work even when new fields are added or old field names change slightly?  If I jus.t do an iteration of every field with &lt;CODE&gt;| rename a AS CMDB_a, | rename b AS CMDB_b ...&lt;/CODE&gt; this will be fragile and break and be a huge blight in the middle of my search.  I cannot do &lt;CODE&gt;| rename * AS CMDB_*&lt;/CODE&gt; because there are many other fields and this search might change to add more non-CMDB fields, too.&lt;/P&gt;</description>
      <pubDate>Sat, 28 Jul 2018 01:41:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378504#M110945</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2018-07-28T01:41:51Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename of all fields that come from calling "| lookup"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378505#M110946</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | rename * AS _HIDE_ALL_FIELDS_*
| lookup YourLookupDefinitionHere host AS _HIDE_ALL_FIELDS_host
| rename * AS CMDB_*
| rename _HIDE_ALL_FIELDS_* AS *
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Jul 2018 01:42:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378505#M110946</guid>
      <dc:creator>Noah_Woodcock</dc:creator>
      <dc:date>2018-07-28T01:42:39Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename of all fields that come from calling "| lookup"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378506#M110947</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;... | lookup YourLookupDefinitionHere host
| rename COMMENT AS "Bulk rename of all fields from this lookup to add prefix 'CMDB_'"
| rename [| inputlookup  YourLookupDefinitionHere
          | head 1
          | foreach * [ eval &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt; = "CMDB_&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;" ]
          | format "" "" "" "" "" ""
| rex field=search mode=sed "s/=/ AS /g"]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Sat, 28 Jul 2018 01:43:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378506#M110947</guid>
      <dc:creator>Noah_Woodcock</dc:creator>
      <dc:date>2018-07-28T01:43:00Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename of all fields that come from calling "| lookup"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378507#M110948</link>
      <description>&lt;P&gt;I had issue with this. it seems to take  the &lt;CODE&gt;_* fields&lt;/CODE&gt; as part of the &lt;CODE&gt;*&lt;/CODE&gt; on the first &lt;CODE&gt;rename&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Thu, 25 Apr 2019 18:33:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378507#M110948</guid>
      <dc:creator>theady</dc:creator>
      <dc:date>2019-04-25T18:33:52Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename of all fields that come from calling "| lookup"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378508#M110949</link>
      <description>&lt;P&gt;It definitely should not and is a bug if it does.&lt;/P&gt;</description>
      <pubDate>Fri, 26 Apr 2019 04:43:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/378508#M110949</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2019-04-26T04:43:41Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename of all fields that come from calling "| lookup"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/504063#M140721</link>
      <description>&lt;P&gt;Came across this solution and noted the comments about _ fields being renamed and it does appear that it won't work as _ fields are also renamed with *&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults
| eval myField=1
| rename * as HIDE_*
| table *&lt;/LI-CODE&gt;&lt;P&gt;shows HIDE__time&lt;/P&gt;&lt;P&gt;and in my example&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename * as _HIDE_ALL_*
| lookup work_status key as _HIDE_ALL_workStatusKey
| rename * as orig_work_status_*
| rename _HIDE_ALL_* as *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;after the second rename, all _HIDE_ fields are now orig_work_status__HIDE_...&lt;/P&gt;&lt;P&gt;which is not the intended outcome - shame - as it was a simple approach.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 12 Jun 2020 06:46:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/504063#M140721</guid>
      <dc:creator>bowesmana</dc:creator>
      <dc:date>2020-06-12T06:46:20Z</dc:date>
    </item>
    <item>
      <title>Re: Bulk rename of all fields that come from calling "| lookup"?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/552195#M156705</link>
      <description>&lt;P&gt;It seems the rename command changed behaviour somewhere along the way and now, as you noted, * matches _ fields too.&lt;/P&gt;&lt;P&gt;You can still use the same method though with a tweak to the final rename:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| rename * as _HIDE_ALL_*
| lookup work_status key as _HIDE_ALL_workStatusKey
| rename * as orig_work_status_*
| rename orig_work_status__HIDE_ALL_* as *&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 19 May 2021 12:05:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Bulk-rename-of-all-fields-that-come-from-calling-quot-lookup/m-p/552195#M156705</guid>
      <dc:creator>davewood</dc:creator>
      <dc:date>2021-05-19T12:05:00Z</dc:date>
    </item>
  </channel>
</rss>

