<?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 multiple field values with the same replacement value in a search? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266874#M80269</link>
    <description>&lt;P&gt;There are few things to consider&lt;/P&gt;

&lt;P&gt;1) Permission on the lookup table. I would suggest start by setting it to global, verify everything is working and then scale back.&lt;/P&gt;

&lt;P&gt;2) Values in the lookup field has to identical (case-sensitive) to the values in index field&lt;/P&gt;

&lt;P&gt;3) see if you get any result for this &lt;CODE&gt;| inputlookup vgate_prod_names&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;4) Try changing the fieldname in the output &lt;CODE&gt;lookup vgate_prod_names product as product OUTPUT meaningful_product AS product_name&lt;/CODE&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 13 Dec 2016 14:10:45 GMT</pubDate>
    <dc:creator>sundareshr</dc:creator>
    <dc:date>2016-12-13T14:10:45Z</dc:date>
    <item>
      <title>How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266865#M80260</link>
      <description>&lt;P&gt;I am working with a field named &lt;STRONG&gt;product&lt;/STRONG&gt; which contains an array of values which I would like to replace with more meaningful values for reporting purposes.&lt;/P&gt;

&lt;P&gt;Currently I am using something along the lines of:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search query | replace product_1 with "Meaningful Product 1 Name", product_2 with "Meaningful Product 2 Name"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This seems to be working fine, however, the problem lies in instances where there are multiple values within the ** field which all relate to the one product. I attempted to approach this as:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search query | replace product_x with "Meaningful Product X Name", product_x2 with "Meaningful Product X Name" 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, this throws an error upon running the search - what would be the correct approach to use here?&lt;/P&gt;

&lt;P&gt;Side note; I am replacing 100+ values within the &lt;STRONG&gt;product&lt;/STRONG&gt; field which is making the search rather verbose - is there a more efficient way to go about this?&lt;/P&gt;

&lt;P&gt;Cheers!&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 00:53:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266865#M80260</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-07T00:53:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266866#M80261</link>
      <description>&lt;P&gt;Have you considered &lt;CODE&gt;lookup&lt;/CODE&gt; tables? Would work something like this&lt;/P&gt;

&lt;P&gt;1) Create a lookup csv with two columns - &lt;CODE&gt;product meaningful_product&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;2) Use the lookup in your search to make dynamic replacement/addition, like this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;base search | lookup productlist.csv product OUTPUT meaningful_product AS product | ...
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.1/Knowledge/Addfieldsfromexternaldatasources"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.1/Knowledge/Addfieldsfromexternaldatasources&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:19:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266866#M80261</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-12-07T15:19:47Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266867#M80262</link>
      <description>&lt;P&gt;Thank you for your response - however I am curious as to whether this dynamic replacement will be viewable to other parties who I may share the report/dashboard with?&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 03:32:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266867#M80262</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-09T03:32:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266868#M80263</link>
      <description>&lt;P&gt;@sundareshr&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 03:32:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266868#M80263</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-09T03:32:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266869#M80264</link>
      <description>&lt;P&gt;Permissions for lookups are configured the same as for report. They can be kept private (no one else can see it), shared at app level (everyone with access to app can see it) globa (everyone can see it). Additionally, lookups can be made automatic as well, So everytime the specific sourcetype is query, meaningful_product is included.&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.1/Knowledge/ConfigureCSVlookups"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.1/Knowledge/ConfigureCSVlookups&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 09 Dec 2016 03:37:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266869#M80264</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-12-09T03:37:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266870#M80265</link>
      <description>&lt;P&gt;Hi I have implemented the lookup CSV file however when I attempt to invoke it, it does not return any results.&lt;/P&gt;

&lt;P&gt;However I did not implement Step 2 in the below guide - is Step 2 essential?&lt;/P&gt;

&lt;P&gt;&lt;A href="https://docs.splunk.com/Documentation/Splunk/6.5.1/Knowledge/ConfigureCSVlookups"&gt;https://docs.splunk.com/Documentation/Splunk/6.5.1/Knowledge/ConfigureCSVlookups&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 05:10:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266870#M80265</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-13T05:10:59Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266871#M80266</link>
      <description>&lt;P&gt;I believe I have figured this out by adding the CSV under Lookup Definitions!&lt;BR /&gt;
Testing now.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 05:27:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266871#M80266</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-13T05:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266872#M80267</link>
      <description>&lt;P&gt;@sundareshr&lt;BR /&gt;
The stanza for the CSV has been added so I am using the following in my search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lookup vgate_prod_names product as product OUTPUT meaningful_product AS product 
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So the search is now returning results, however the Product field is displaying as blank for all events?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 05:41:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266872#M80267</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-13T05:41:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266873#M80268</link>
      <description>&lt;P&gt;I have setup a lookup CSV which looks something like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;product, meaningful_product
product_1, "Meaningful Name 1"
product_2, "Meaningful Name 2"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;etc..&lt;/P&gt;

&lt;P&gt;I have added the lookup file to the Splunk Lookup Table files as below;&lt;/P&gt;

&lt;P&gt;/opt/splunk/etc/apps/search/lookups/product_names.csv&lt;/P&gt;

&lt;P&gt;I have added a Lookup Definition for the CSV as below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;Name                  Type      Supported Fields
vgate_prod_names      file      product,meaningful_product
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Now that I have completed all of the above steps, I am testing this in one of my searches in a similar method to the below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search query | lookup vgate_prod_names product AS product OUTPUT meaningful_product AS product | more search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I have also tried this syntax:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;search query | lookup vgate_prod_names product OUTPUT meaningful_product AS product | more search
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However in both instances, the search returns all of the results it should, however the &lt;STRONG&gt;product&lt;/STRONG&gt; field contains &lt;STRONG&gt;only blank values&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;What am I doing wrong??&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 06:12:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266873#M80268</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-13T06:12:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266874#M80269</link>
      <description>&lt;P&gt;There are few things to consider&lt;/P&gt;

&lt;P&gt;1) Permission on the lookup table. I would suggest start by setting it to global, verify everything is working and then scale back.&lt;/P&gt;

&lt;P&gt;2) Values in the lookup field has to identical (case-sensitive) to the values in index field&lt;/P&gt;

&lt;P&gt;3) see if you get any result for this &lt;CODE&gt;| inputlookup vgate_prod_names&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;4) Try changing the fieldname in the output &lt;CODE&gt;lookup vgate_prod_names product as product OUTPUT meaningful_product AS product_name&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 14:10:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266874#M80269</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-12-13T14:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266875#M80270</link>
      <description>&lt;P&gt;@sundareshr as a side note, if I change my query to:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;lookup vgate_prod_names product as product OUTPUT meaningful_product AS product_new
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The I get a new field added to my search called "product_new" with all the values whigh I expected from my original search.&lt;/P&gt;

&lt;P&gt;Is it true that I need to have a replacement value for EVERY possible value of product in my lookup table for this function to work correctly?&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 16:34:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266875#M80270</guid>
      <dc:creator>alexandermunce</dc:creator>
      <dc:date>2016-12-13T16:34:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to replace multiple field values with the same replacement value in a search?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266876#M80271</link>
      <description>&lt;P&gt;For the replacement to work correctly, the value in &lt;CODE&gt;product&lt;/CODE&gt; field has to match. You do have the option of setting up your lookup with wildcards, but the replacement will the same for all matching values. For example prod1, prod2, prod3 can have a single prod* in the lookup to map to "same description for any of the three variations". For this to work, you will have to configure your lookup as &lt;/P&gt;

&lt;P&gt;&lt;A href="https://answers.splunk.com/answers/52580/can-we-use-wildcard-characters-in-a-lookup-table.html"&gt;https://answers.splunk.com/answers/52580/can-we-use-wildcard-characters-in-a-lookup-table.html&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 13 Dec 2016 16:49:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-replace-multiple-field-values-with-the-same-replacement/m-p/266876#M80271</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-12-13T16:49:34Z</dc:date>
    </item>
  </channel>
</rss>

