<?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 How to change a value at index time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407301#M117632</link>
    <description>&lt;P&gt;Hiya, simple question here.  I want to change the way a value is represented to me after I index, see the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2014-02-21 10:42:57 support-1 root: [ID 702911 daemon.notice] * &amp;lt;WARNING&amp;gt; : target=backed(up
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want "backed(up" to be replaced with "backed-up".  Any suggestions?&lt;/P&gt;</description>
    <pubDate>Tue, 22 May 2018 20:59:10 GMT</pubDate>
    <dc:creator>JPrictoe</dc:creator>
    <dc:date>2018-05-22T20:59:10Z</dc:date>
    <item>
      <title>How to change a value at index time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407301#M117632</link>
      <description>&lt;P&gt;Hiya, simple question here.  I want to change the way a value is represented to me after I index, see the following:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2014-02-21 10:42:57 support-1 root: [ID 702911 daemon.notice] * &amp;lt;WARNING&amp;gt; : target=backed(up
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I want "backed(up" to be replaced with "backed-up".  Any suggestions?&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 20:59:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407301#M117632</guid>
      <dc:creator>JPrictoe</dc:creator>
      <dc:date>2018-05-22T20:59:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to change a value at index time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407302#M117633</link>
      <description>&lt;P&gt;You can use data masking/anonymization methods listed in below link to replace a string with another.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/SplunkCloud/latest/Data/Anonymizedata"&gt;http://docs.splunk.com/Documentation/SplunkCloud/latest/Data/Anonymizedata&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 May 2018 21:21:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407302#M117633</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2018-05-22T21:21:06Z</dc:date>
    </item>
    <item>
      <title>Re: How to change a value at index time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407303#M117634</link>
      <description>&lt;P&gt;@JPrictoe&lt;/P&gt;

&lt;P&gt;After data is indexed. If you want to change the following underling data only in your query. &lt;BR /&gt;
Then you can try something like i mentioned below. This won't change the data in index.&lt;/P&gt;

&lt;P&gt;| makeresults &lt;BR /&gt;
| eval target="backed(up"&lt;BR /&gt;
| replace "backed(up"  with  "backed-up"&lt;BR /&gt;
| table target &lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 05:02:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407303#M117634</guid>
      <dc:creator>Shan</dc:creator>
      <dc:date>2018-05-23T05:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to change a value at index time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407304#M117635</link>
      <description>&lt;P&gt;Try this :&lt;/P&gt;

&lt;P&gt;If you want to anonymize data at &lt;STRONG&gt;search time then try :&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw=" 2014-02-21 10:42:57 support-1 root: [ID 702911 daemon.notice] * &amp;lt;WARNING&amp;gt; : target=backed(up" 
| rex field=_raw mode=sed "s/(backed)\((up)/\1-\2/g"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;at index time then try:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;1) Edit or create a copy of props.conf in &lt;CODE&gt;$SPLUNK_HOME/etc/system/local&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;Create a props.conf stanza that uses &lt;CODE&gt;SEDCMD&lt;/CODE&gt; to indicate a sed script:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[&amp;lt;your_sourcetype&amp;gt;]
SEDCMD-backedup = s/(backed)\((up)/\1-\2/g
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;2) After making changes to props.conf, restart the Splunk instance to enable the configuration.&lt;BR /&gt;
let me know if this helps!&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 06:14:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407304#M117635</guid>
      <dc:creator>mayurr98</dc:creator>
      <dc:date>2018-05-23T06:14:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to change a value at index time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407305#M117636</link>
      <description>&lt;P&gt;@shankarananth you are missing &lt;CODE&gt;in target&lt;/CODE&gt; argument in your replace command, otherwise it will apply to all the available fields.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval target="backed(up", someotherfield="backed(up"
| replace "backed(up" with "backed-up"
| table target someotherfield
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;So correct query is &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval target="backed(up", someotherfield="backed(up"
| replace "backed(up" with "backed-up" in target
| table target someotherfield
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Here is another option with &lt;CODE&gt;replace()&lt;/CODE&gt; evaluation function&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval target="backed(up", someotherfield="backed(up"
| eval target=replace(target,"(backed)\((up)","\1\2")
| table target
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;However, better approach would be to use SEDCMD during index-time as suggested by @mayurr98 and @somesoni2, so that data is indexed as expected, rather than using search time field corrections. As per your question you are looking for index time correction.&lt;/P&gt;

&lt;P&gt;You should also check out the feasibility of correcting the logging by application in the first place if the logged text is not as expected. Even if you don't own the code or the app is third party, you can always notify them of such correction with miss-spelled/incorrect logging!&lt;/P&gt;</description>
      <pubDate>Wed, 23 May 2018 06:52:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-change-a-value-at-index-time/m-p/407305#M117636</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-05-23T06:52:56Z</dc:date>
    </item>
  </channel>
</rss>

