<?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: SPL query to replace ALL values in a field with &amp;quot;Hello World&amp;quot; in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440875#M125290</link>
    <description>&lt;P&gt;EDIT: I've also tried &lt;CODE&gt;index="my_index" | rex mode=sed field=my_field "s/.*/Hello World/g"&lt;/CODE&gt; but had no luck with that&lt;/P&gt;</description>
    <pubDate>Thu, 08 Aug 2019 17:07:38 GMT</pubDate>
    <dc:creator>brinley</dc:creator>
    <dc:date>2019-08-08T17:07:38Z</dc:date>
    <item>
      <title>SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440873#M125288</link>
      <description>&lt;P&gt;I'm trying to write a simple query to replace &lt;EM&gt;all&lt;/EM&gt; of the values in a field (let's call this field &lt;CODE&gt;my_field&lt;/CODE&gt;) with a single value (like &lt;CODE&gt;"Hello World"&lt;/CODE&gt;).&lt;BR /&gt;
According to the splunk docs on &lt;CODE&gt;replace&lt;/CODE&gt;, this should be pretty simple but the following query I have right now isn't working:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="my_index" | replace * WITH "Hello World" IN my_field&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I've also tried an even simpler query to replace a specific value (let's call this value &lt;CODE&gt;"Puppies"&lt;/CODE&gt;) in &lt;CODE&gt;my_field&lt;/CODE&gt; with &lt;CODE&gt;"Hello World"&lt;/CODE&gt;, but that's not working either:&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="my_index" | replace "Puppies" WITH "Hello World" IN my_field&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;I know I'm missing something obvious. Any ideas about what I can do? &lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 16:35:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440873#M125288</guid>
      <dc:creator>brinley</dc:creator>
      <dc:date>2019-08-08T16:35:38Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440874#M125289</link>
      <description>&lt;P&gt;EDIT: I've also tried &lt;CODE&gt;index="my_index" | eval my_field=replace(my_field, *, "Hello World")&lt;/CODE&gt; but that didn't seem to work either&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 16:57:30 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440874#M125289</guid>
      <dc:creator>brinley</dc:creator>
      <dc:date>2019-08-08T16:57:30Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440875#M125290</link>
      <description>&lt;P&gt;EDIT: I've also tried &lt;CODE&gt;index="my_index" | rex mode=sed field=my_field "s/.*/Hello World/g"&lt;/CODE&gt; but had no luck with that&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:07:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440875#M125290</guid>
      <dc:creator>brinley</dc:creator>
      <dc:date>2019-08-08T17:07:38Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440876#M125291</link>
      <description>&lt;P&gt;Here is one way, using rex in sed mode&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval raw2=split("f1=123 f2=456,f1=234 f2=567",",")
| mvexpand raw2 | eval _raw=raw2 | extract | fields - _raw raw2
| rex mode=sed field=f1 "s/.*/Hello World/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;No matter what values f1 has, they get replaced by Hello World.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;_time                 f1             f2
2019-08-08 13:25:28 Hello World 456
2019-08-08 13:25:28 Hello World 567
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:26:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440876#M125291</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-08-08T17:26:12Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440877#M125292</link>
      <description>&lt;P&gt;can you provide output of the query after which you want to change the values? &lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:32:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440877#M125292</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2019-08-08T17:32:51Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440878#M125293</link>
      <description>&lt;P&gt;@jpolvino  thanks for this answer. Unfortunately it does not provide me with what I need. See below for explanation&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:37:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440878#M125293</guid>
      <dc:creator>brinley</dc:creator>
      <dc:date>2019-08-08T17:37:37Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440879#M125294</link>
      <description>&lt;P&gt;@jpolvino I've already tried something similar to what you provided: &lt;BR /&gt;
&lt;CODE&gt;index="my_index" | rex mode=sed field=my_field "s/.*/Hello World/g"&lt;/CODE&gt; but that didn't work for an unknown reason.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440879#M125294</guid>
      <dc:creator>brinley</dc:creator>
      <dc:date>2019-08-08T17:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440880#M125295</link>
      <description>&lt;P&gt;If you want a static value, then how about just&lt;BR /&gt;
| eval my_field="Hello world"&lt;BR /&gt;
Or am I still missing something?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:41:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440880#M125295</guid>
      <dc:creator>jpolvino</dc:creator>
      <dc:date>2019-08-08T17:41:26Z</dc:date>
    </item>
    <item>
      <title>Re: SPL query to replace ALL values in a field with "Hello World"</title>
      <link>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440881#M125296</link>
      <description>&lt;P&gt;@jpolvino It looks like a can create a new field whose values are all "Hello World" but when I try to set &lt;CODE&gt;my_field&lt;/CODE&gt; to &lt;CODE&gt;new_field&lt;/CODE&gt;, it doesn't work, which boggles my mind b/c I've done very similar things before. Here's what I tried: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;index="my_index" | eval new_field=replace(my_field, ".*", "Hello World") | eval my_field=new_field&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;For an unknown reason,&lt;CODE&gt;my_field&lt;/CODE&gt; does not get updated with &lt;CODE&gt;new_field&lt;/CODE&gt;'s values &lt;span class="lia-unicode-emoji" title=":disappointed_face:"&gt;😞&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Aug 2019 17:42:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/SPL-query-to-replace-ALL-values-in-a-field-with-quot-Hello-World/m-p/440881#M125296</guid>
      <dc:creator>brinley</dc:creator>
      <dc:date>2019-08-08T17:42:06Z</dc:date>
    </item>
  </channel>
</rss>

