<?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: Add and remove text from a field at extraction time in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123090#M33223</link>
    <description>&lt;P&gt;A SEARCH time solution (or two)&lt;/P&gt;

&lt;P&gt;Option 1: Use the &lt;CODE&gt;replace&lt;/CODE&gt; command (documentation &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchReference/Replace"&gt;here&lt;/A&gt;.) This works great if you only have a few changes to make, and if you only want to do it for a single report.&lt;/P&gt;

&lt;P&gt;Option 2: Use an automatic lookup. This allows you to create an entirely new field. You can have both the new field and the original field.  A lookup table can contain thousands of values and is easier than a series of replacements. If you set up the lookup as automatic, the new field will always be present.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchTutorial/Usefieldlookups"&gt;Use field lookups&lt;/A&gt; is a tutorial that uses the Splunk UI. I recommend it.&lt;/P&gt;</description>
    <pubDate>Fri, 12 Sep 2014 21:21:21 GMT</pubDate>
    <dc:creator>lguinn2</dc:creator>
    <dc:date>2014-09-12T21:21:21Z</dc:date>
    <item>
      <title>Add and remove text from a field at extraction time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123086#M33219</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;

&lt;P&gt;Is there a way to add text to a field that matches a specific pattern?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Example:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;log:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;2014-09-12 13:40:12,359 "GET /app/rest/1.0/payableinvoicelink/100-129880-2fc616a5-33d5-4567-9abf-71b1234a3d36 HTTP/1.1"&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;What I would like to have:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;requestType: "GET /app/rest/1.0/payableinvoicelink/getById"&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;Another example:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;log:&lt;BR /&gt;
2014-09-12 13:40:12,359 "GET /app/rest/1.0/application/674536 HTTP/1.1"&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;What I would like to have:&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;requestType: "GET /app/rest/1.0/application/getById"&lt;/P&gt;

&lt;P&gt;Is there an elegant way of achieving this?&lt;/P&gt;

&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2014 17:57:47 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123086#M33219</guid>
      <dc:creator>splunkmasterfle</dc:creator>
      <dc:date>2014-09-12T17:57:47Z</dc:date>
    </item>
    <item>
      <title>Re: Add and remove text from a field at extraction time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123087#M33220</link>
      <description>&lt;P&gt;An INDEX time solution - which means that all of your data would need to be reindexed. Also, the original value would be gone...&lt;/P&gt;

&lt;P&gt;In the Splunk manuals, there is a section called &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/Data/Anonymizedatausingconfigurationfiles"&gt;Anonymize data&lt;/A&gt;, which shows how to replace certain patterns in your input with "XXXX" or "####". Follow those instructions, but use "getById" (or whatever you want) instead of "XXX".&lt;/P&gt;

&lt;P&gt;Example 1 (using &lt;CODE&gt;transforms.conf&lt;/CODE&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[fix-application]
REGEX = (.*?)GET /app/rest/1.0/application/674536 HTTP/1.1(.*)
FORMAT = $1GET /app/rest/1.0/application/getById$2
DEST_KEY = _raw
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Example 2 (using only &lt;CODE&gt;props.conf&lt;/CODE&gt;)&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;SEDCMD-fix2 = s/(GET \/app\/rest\/1.0\/payableinvoicelink\/)100-129880-2fc616a5-33d5-4567-9abf-71b1234a3d36 HTTP\/1.1\/\1 getById/
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note that I had to escape the &lt;CODE&gt;/&lt;/CODE&gt; in the second example, which makes it a bit harder to read&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2014 18:09:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123087#M33220</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-09-12T18:09:01Z</dc:date>
    </item>
    <item>
      <title>Re: Add and remove text from a field at extraction time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123088#M33221</link>
      <description>&lt;P&gt;Does this work at index time? Meaning I have to re-import all of my data ?&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2014 18:55:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123088#M33221</guid>
      <dc:creator>splunkmasterfle</dc:creator>
      <dc:date>2014-09-12T18:55:02Z</dc:date>
    </item>
    <item>
      <title>Re: Add and remove text from a field at extraction time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123089#M33222</link>
      <description>&lt;P&gt;Ah, good point, all of this is at &lt;EM&gt;index&lt;/EM&gt; time. Another answer follows for how to do it at search time.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2014 21:12:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123089#M33222</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-09-12T21:12:55Z</dc:date>
    </item>
    <item>
      <title>Re: Add and remove text from a field at extraction time</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123090#M33223</link>
      <description>&lt;P&gt;A SEARCH time solution (or two)&lt;/P&gt;

&lt;P&gt;Option 1: Use the &lt;CODE&gt;replace&lt;/CODE&gt; command (documentation &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchReference/Replace"&gt;here&lt;/A&gt;.) This works great if you only have a few changes to make, and if you only want to do it for a single report.&lt;/P&gt;

&lt;P&gt;Option 2: Use an automatic lookup. This allows you to create an entirely new field. You can have both the new field and the original field.  A lookup table can contain thousands of values and is easier than a series of replacements. If you set up the lookup as automatic, the new field will always be present.&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.3/SearchTutorial/Usefieldlookups"&gt;Use field lookups&lt;/A&gt; is a tutorial that uses the Splunk UI. I recommend it.&lt;/P&gt;</description>
      <pubDate>Fri, 12 Sep 2014 21:21:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Add-and-remove-text-from-a-field-at-extraction-time/m-p/123090#M33223</guid>
      <dc:creator>lguinn2</dc:creator>
      <dc:date>2014-09-12T21:21:21Z</dc:date>
    </item>
  </channel>
</rss>

