<?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: Can Splunk decode data at index time? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10060#M256</link>
    <description>&lt;P&gt;Thank you, Josh!  I think this is the most promising approach.  I will give it a try and post results here.&lt;/P&gt;</description>
    <pubDate>Tue, 09 Mar 2010 07:19:57 GMT</pubDate>
    <dc:creator>hulahoop</dc:creator>
    <dc:date>2010-03-09T07:19:57Z</dc:date>
    <item>
      <title>Can Splunk decode data at index time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10057#M253</link>
      <description>&lt;P&gt;If I have a field value that is URL encoded then base-64 encoded, is it possible to have Splunk decode this field before indexing (maybe via a custom processor)?  Has anyone done this before?  Is it recommended?  How difficult is it?&lt;/P&gt;

&lt;P&gt;This is probably easily done with a custom search script at search time, but that is a less desirable approach as a user would need to have advanced understanding to run the search through this custom search command.&lt;/P&gt;

&lt;P&gt;Here is a sample event with the &lt;CODE&gt;body&lt;/CODE&gt; field encoded:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;2010-02-26 03:19:29    : LOG: M=Ce3zW5GtsGE= A=anonymous S=48976970336315650 pt=100001 body=T%3d2010-02-26%2003%3a17%3a45%20PST%26L%3di%26M%3d%5bg2mfeedback%5d%26N%3d553%26X%3d%253cG2MFeedback%253e%2520FeedbackTracker%253a%253aupdate()%2520lastUpdateTime%25201267183021171%2520curTime%25201267183051205%2520timeSinceUpdate%252030034%2520currentAttentivenessState%25201%2520_currentSatisfactionState%25202%2520-%2520Tracker%2520025A6658%252c%2520Seconds%2520in%2520great%252039818%253b%2520fair%25200%253b%2520poor%25200%253b%2520attentive%252039818%253b%2520not%25200%0d%0aT%3d
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 09 Mar 2010 01:48:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10057#M253</guid>
      <dc:creator>hulahoop</dc:creator>
      <dc:date>2010-03-09T01:48:53Z</dc:date>
    </item>
    <item>
      <title>Re: Can Splunk decode data at index time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10058#M254</link>
      <description>&lt;P&gt;In ooooold days (1.0-ish),&amp;nbsp;Splunk imagined the processors as a customer-available API, but there were a variety of problems.  The binary interfaces were too brittle, and the API-challenges were not conducive to plugging in arbitrary code.&lt;/P&gt;

&lt;P&gt;While it's technically still possible to plug in your own processor by wiring up the xml and building the code just so, it's not easy, and definitely not recommended.&lt;/P&gt;

&lt;P&gt;The more loosely coupled approach of handling this in an input script is probably the way to go.  You can be fancy and set up a scripted input, which will end up being responsible for checkpointing and file handling.  My preference is to just have a script that preprocesses foo.log into foo.log.processed, or similar, and have Splunk watch the processed version.  It's easy to write, easy to debug, and easy to configure Splunk to use.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2010 05:12:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10058#M254</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2010-03-09T05:12:20Z</dc:date>
    </item>
    <item>
      <title>Re: Can Splunk decode data at index time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10059#M255</link>
      <description>&lt;P&gt;On re-read, I don't see any performance concerns.  You can achieve your field filtering transparently via a scripted lookup&lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/5.0/Knowledge/Addfieldsfromexternaldatasources#Set_up_a_fields_lookup_based_on_an_external_command" rel="nofollow"&gt;http://docs.splunk.com/Documentation/Splunk/5.0/Knowledge/Addfieldsfromexternaldatasources#Set_up_a_fields_lookup_based_on_an_external_command&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2010 05:14:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10059#M255</guid>
      <dc:creator>jrodman</dc:creator>
      <dc:date>2010-03-09T05:14:55Z</dc:date>
    </item>
    <item>
      <title>Re: Can Splunk decode data at index time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10060#M256</link>
      <description>&lt;P&gt;Thank you, Josh!  I think this is the most promising approach.  I will give it a try and post results here.&lt;/P&gt;</description>
      <pubDate>Tue, 09 Mar 2010 07:19:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10060#M256</guid>
      <dc:creator>hulahoop</dc:creator>
      <dc:date>2010-03-09T07:19:57Z</dc:date>
    </item>
    <item>
      <title>Re: Can Splunk decode data at index time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10061#M257</link>
      <description>&lt;P&gt;I implemented the external lookup. The encoding turns out to be a double URL encoding, not a URL encoding followed by a base 64 encoding as originally stated.  The lookup works just okay--it presents a new field 'body_decoded' with decoded field value.  However, since the decoding is done at search time, searching is awkward. You need to use 'body_decoded=&lt;EM&gt;coolstuff&lt;/EM&gt;'.  A keyword search does not work since the value of the 'body' field was not segmented at index time.  We will have to pursue the alternative--process the log file before indexing.  Wish this could be done in Splunk more easily.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 09:11:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10061#M257</guid>
      <dc:creator>hulahoop</dc:creator>
      <dc:date>2020-09-28T09:11:03Z</dc:date>
    </item>
    <item>
      <title>Re: Can Splunk decode data at index time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10062#M258</link>
      <description>&lt;P&gt;You could also do:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;FIELDALIAS-body = body AS body_encoded
LOOKUP-urldecode = urldecode body_encoded OUTPUT body_decoded AS body
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This will work, as the order goes: &lt;CODE&gt;EXTRACT&lt;/CODE&gt;, &lt;CODE&gt;FIELDALIAS&lt;/CODE&gt;, &lt;CODE&gt;LOOKUP&lt;/CODE&gt;. You could also just change your extraction to extract &lt;CODE&gt;body&lt;/CODE&gt; as &lt;CODE&gt;body_encoded&lt;/CODE&gt;, but that might be a pain if you're just using KV_MODE.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2010 14:58:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10062#M258</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-03-10T14:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: Can Splunk decode data at index time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10063#M259</link>
      <description>&lt;P&gt;Hmm I meant to format that:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; FIELDALIAS-body = body AS body_encoded
 LOOKUP-urldecode = urldecode body_encoded OUTPUT body_decoded AS body
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 10 Mar 2010 14:59:49 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10063#M259</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-03-10T14:59:49Z</dc:date>
    </item>
    <item>
      <title>Re: Can Splunk decode data at index time?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10064#M260</link>
      <description>&lt;P&gt;Alright, fine, you get the idea.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Mar 2010 15:00:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Can-Splunk-decode-data-at-index-time/m-p/10064#M260</guid>
      <dc:creator>gkanapathy</dc:creator>
      <dc:date>2010-03-10T15:00:14Z</dc:date>
    </item>
  </channel>
</rss>

