<?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: Is it possible to parse an extracted field as json if the whole log line isn't json? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110695#M23243</link>
    <description>&lt;P&gt;This is something that I'd use in a search? Or can this be applied to a log source?&lt;/P&gt;</description>
    <pubDate>Tue, 22 Oct 2013 23:19:17 GMT</pubDate>
    <dc:creator>stevennoble</dc:creator>
    <dc:date>2013-10-22T23:19:17Z</dc:date>
    <item>
      <title>Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110693#M23241</link>
      <description>&lt;P&gt;If I have a line of my logs that look something like&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[2013-10-18 23:36:50.785476] {"message":"some message", "headers": {"a": 1, "b": 2}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;is there a way I can use splunk's regex extraction to separate the timestamp from the json, then use splunk's json extraction to to extract fields from the json?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2013 22:38:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110693#M23241</guid>
      <dc:creator>stevennoble</dc:creator>
      <dc:date>2013-10-22T22:38:56Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110694#M23242</link>
      <description>&lt;P&gt;You can't use &lt;CODE&gt;KV_MODE=json&lt;/CODE&gt; in props.conf because in its current state the event is not fully json. Additionally you can't extract the rest of the messages and then use the same setting on it (again, from props.conf). However, you can do it inline with &lt;CODE&gt;spath&lt;/CODE&gt;. &lt;/P&gt;

&lt;P&gt;Extract the whole json message in a field called, say, &lt;CODE&gt;my_field&lt;/CODE&gt;, then use &lt;CODE&gt;spath&lt;/CODE&gt;: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;...| spath input=my_field&lt;/CODE&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2013 23:11:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110694#M23242</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2013-10-22T23:11:51Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110695#M23243</link>
      <description>&lt;P&gt;This is something that I'd use in a search? Or can this be applied to a log source?&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2013 23:19:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110695#M23243</guid>
      <dc:creator>stevennoble</dc:creator>
      <dc:date>2013-10-22T23:19:17Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110696#M23244</link>
      <description>&lt;P&gt;Inline in a search. You can follow the &lt;CODE&gt;..|spath input=my_field&lt;/CODE&gt; with any other search commands. More details and examples here: &lt;A href="http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath"&gt;http://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 22 Oct 2013 23:22:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110696#M23244</guid>
      <dc:creator>_d_</dc:creator>
      <dc:date>2013-10-22T23:22:13Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110697#M23245</link>
      <description>&lt;P&gt;You can remove the string leader using &lt;EM&gt;any&lt;/EM&gt; the following methods:&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Remove leader by pretending it's a line breaker&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
LINE_BREAKER=((:?^|\n).+?){&lt;BR /&gt;
SHOULD_LINEMERGE=false&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Removing the leader with SEDCMD:&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
SEDCMD-StripHeader=s/^[^{]+//&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Removing the leader via a transform on _raw:&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
; in transforms.conf:&lt;BR /&gt;
[StripSyslog]&lt;BR /&gt;
REGEX = ^[^{]+(.*)$&lt;BR /&gt;
FORMAT = $1&lt;BR /&gt;
DEST_KEY = _raw&lt;BR /&gt;
&lt;/CODE&gt;&lt;BR /&gt;
&lt;CODE&gt;&lt;BR /&gt;
; in props.conf:&lt;BR /&gt;
TRANSFORMS-StripSyslog = StripSyslog&lt;BR /&gt;
&lt;/CODE&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;All these methods will work with &lt;CODE&gt;KV_MODE=json&lt;/CODE&gt;, but note that &lt;A href="http://answers.splunk.com/answers/145388/indexed_extractionsjson-with-transform" target="_blank"&gt;currently they will not work&lt;/A&gt; with &lt;CODE&gt;INDEXED_EXTRACTIONS=json&lt;/CODE&gt;.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:04:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110697#M23245</guid>
      <dc:creator>kamermans</dc:creator>
      <dc:date>2020-09-28T17:04:38Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110698#M23246</link>
      <description>&lt;P&gt;This is a bummer ... We have jason as part of an event.  Would love to have field extraction happen under the hood, e.g. in props.conf or transforms.conf.&lt;BR /&gt;
Seems like there is a way based on postings in this thread. (?)&lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 14:51:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110698#M23246</guid>
      <dc:creator>wsnyder2</dc:creator>
      <dc:date>2015-10-30T14:51:50Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110699#M23247</link>
      <description>&lt;P&gt;Can I do this and keep my header? &lt;/P&gt;</description>
      <pubDate>Fri, 30 Oct 2015 15:00:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110699#M23247</guid>
      <dc:creator>wsnyder2</dc:creator>
      <dc:date>2015-10-30T15:00:52Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110700#M23248</link>
      <description>&lt;P&gt;Was any one able to do this? as originally described, ie. without using spath?&lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 21:29:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110700#M23248</guid>
      <dc:creator>prees</dc:creator>
      <dc:date>2015-12-08T21:29:39Z</dc:date>
    </item>
    <item>
      <title>Re: Is it possible to parse an extracted field as json if the whole log line isn't json?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110701#M23249</link>
      <description>&lt;P&gt;Second what @wsnyder2 said. Is it possible to do this and still retain the info from the header?&lt;/P&gt;

&lt;P&gt;EDIT: or is it possible to pre-transform them based on the header then apply this transform? &lt;/P&gt;</description>
      <pubDate>Tue, 08 Dec 2015 21:39:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Is-it-possible-to-parse-an-extracted-field-as-json-if-the-whole/m-p/110701#M23249</guid>
      <dc:creator>prees</dc:creator>
      <dc:date>2015-12-08T21:39:16Z</dc:date>
    </item>
  </channel>
</rss>

