<?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: How to parse and extract JSON log files in Splunk? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164099#M33243</link>
    <description>&lt;P&gt;Not exactly sure why that warranted a down vote, as search-time extractions are pretty normal in Splunk and the question didn't call specifically for indexed extractions...furthermore indexed extractions are generally &lt;EM&gt;not&lt;/EM&gt; recommended. Both answers are technically valid.&lt;/P&gt;</description>
    <pubDate>Tue, 15 Mar 2016 20:46:28 GMT</pubDate>
    <dc:creator>mikemishou</dc:creator>
    <dc:date>2016-03-15T20:46:28Z</dc:date>
    <item>
      <title>How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164088#M33232</link>
      <description>&lt;P&gt;I need to parse Tableau 8.2 JSON log files. Sample two rows of the log files is as below:&lt;/P&gt;

&lt;P&gt;{"ts":"2014-07-30T07:14:06.840","pid":2104,"tid":"1e88","sev":"info","req":"U9j9rgqgYVgAAA@kHr8AAAHs","sess":"B84F19DEC88D4362B9164D87A687CFBC-0:1","site":"Default","user":"nsawant","k":"begin-query","v":{"protocol":"c4561a0","query":"(restrict (aggregate (select (project (table [Extract].[Extract]) ((&lt;A href="https://community.splunk.com/year%20%5BDate%5D"&gt;yr:Date:ok&lt;/A&gt;) ([none:Region:nk] [Region]) ([none:Country / Region:nk] [Country / Region]))) (= [none:Region:nk] \"Asia\")) (([none:Country / Region:nk] [none:Country / Region:nk])) ((&lt;A href="average%20%5BP:%20Population%20(count)%5D"&gt;avg:P: Population (count):ok&lt;/A&gt;))) ([none:Country / Region:nk] [avg:P: Population (count):ok]))"}}&lt;BR /&gt;
{"ts":"2014-07-30T07:14:06.856","pid":2104,"tid":"1e88","sev":"info","req":"U9j9rgqgYVgAAA@kHr8AAAHs","sess":"B84F19DEC88D4362B9164D87A687CFBC-0:1","site":"Default","user":"nsawant","k":"end-query","v":{"protocol":"c4561a0","cols":2,"query":"(restrict (aggregate (select (project (table [Extract].[Extract]) ((&lt;A href="https://community.splunk.com/year%20%5BDate%5D"&gt;yr:Date:ok&lt;/A&gt;) ([none:Region:nk] [Region]) ([none:Country / Region:nk] [Country / Region]))) (= [none:Region:nk] \"Asia\")) (([none:Country / Region:nk] [none:Country / Region:nk])) ((&lt;A href="average%20%5BP:%20Population%20(count)%5D"&gt;avg:P: Population (count):ok&lt;/A&gt;))) ([none:Country / Region:nk] [avg:P: Population (count):ok]))","rows":34,"elapsed":0.011}}&lt;/P&gt;

&lt;P&gt;Is there a way to use Splunk to parse this and extract one value? If so, how?&lt;/P&gt;

&lt;P&gt;Thank you in advance.&lt;/P&gt;

&lt;P&gt;Best Regards,&lt;BR /&gt;
Namrata Sawant&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2014 15:46:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164088#M33232</guid>
      <dc:creator>nsawant</dc:creator>
      <dc:date>2014-07-30T15:46:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164089#M33233</link>
      <description>&lt;P&gt;Did you try spath command? &lt;/P&gt;

&lt;P&gt;&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/Spath"&gt;http://docs.splunk.com/Documentation/Splunk/6.0/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2014 15:51:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164089#M33233</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2014-07-30T15:51:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164090#M33234</link>
      <description>&lt;P&gt;Well I am a complete newbie and still trying to figure out where and how I need to use the "spath" command? Do you have any video tutorial that demonstrates this?&lt;/P&gt;

&lt;P&gt;Thank you!&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2014 16:17:18 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164090#M33234</guid>
      <dc:creator>nsawant</dc:creator>
      <dc:date>2014-07-30T16:17:18Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164091#M33235</link>
      <description>&lt;P&gt;Namrata,&lt;BR /&gt;
You can also have Splunk extract all these fields automatically during index time using KV_MODE = JSON setting in the props.conf. Give it a shot it is a feature I think of Splunk 6+. For example:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[Tableau_log]
KV_MODE = JSON
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;It is actually really efficient as Splunk has a built in parser for it.&lt;/P&gt;</description>
      <pubDate>Wed, 30 Jul 2014 17:21:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164091#M33235</guid>
      <dc:creator>jhernandez_splu</dc:creator>
      <dc:date>2014-07-30T17:21:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164092#M33236</link>
      <description>&lt;P&gt;You'll get a real boost of performance when using Splunk 6.1's &lt;CODE&gt;INDEXED_EXTRACTIONS = json&lt;/CODE&gt; switch.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[your_sourcetype]
INDEXED_EXTRACTIONS = json
KV_MODE = none
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Note, this does change some other behaviour. For example, there's a &lt;CODE&gt;TIMESTAMP_FIELDS&lt;/CODE&gt; setting that exploits the JSON structure rather than specifying TIME_FORMAT or TIME_PREFIX expressions to manually walk through the structure. See the relevant section in &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.2/Admin/Propsconf" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.2/Admin/Propsconf&lt;/A&gt; and &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1.2/Data/Extractfieldsfromfileheadersatindextime" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.1.2/Data/Extractfieldsfromfileheadersatindextime&lt;/A&gt; for more info.&lt;/P&gt;</description>
      <pubDate>Mon, 28 Sep 2020 17:14:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164092#M33236</guid>
      <dc:creator>martin_mueller</dc:creator>
      <dc:date>2020-09-28T17:14:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164093#M33237</link>
      <description>&lt;P&gt;Bumping this topic. Is there a specific use case for these two modes of extracting JSON stuff?&lt;/P&gt;

&lt;P&gt;And what about the overhead if any?&lt;/P&gt;

&lt;P&gt;Documentation is fairly sketchy on this topic.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Nov 2015 12:28:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164093#M33237</guid>
      <dc:creator>cmeo</dc:creator>
      <dc:date>2015-11-25T12:28:23Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164094#M33238</link>
      <description>&lt;P&gt;&lt;CODE&gt;KV_MODE = json&lt;/CODE&gt; tells splunk to automatically perform search time extractions on json data&lt;BR /&gt;
&lt;CODE&gt;INDEXED_EXTRACTIONS = json&lt;/CODE&gt; tells splunk to create index time extractions for the data&lt;/P&gt;

&lt;P&gt;In the first scenario you are saving disk at the expense of processing power (and potentially search time)&lt;BR /&gt;
In the second scenario you are saving processing power (and potentially search time) at the expense of disk&lt;/P&gt;</description>
      <pubDate>Mon, 11 Jan 2016 04:00:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164094#M33238</guid>
      <dc:creator>jmeyers_splunk</dc:creator>
      <dc:date>2016-01-11T04:00:38Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164095#M33239</link>
      <description>&lt;P&gt;I don't know of a video, but this search should work as a quick demo. &lt;/P&gt;

&lt;P&gt;The json you posted does not validate because of the broken quotes around ' Asia '.  I fixed that, then escaped the quotes (so that I could inject it via the search bar).&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=_internal | head 1 | eval f = "{\"ts\": \"2014-07-30T07:14:06.840\",\"pid\": 2104,\"tid\": \"1e88\",\"sev\": \"info\",\"req\": \"U9j9rgqgYVgAAA@kHr8AAAHs\",\"sess\": \"B84F19DEC88D4362B9164D87A687CFBC-0:1\",\"site\": \"Default\",\"user\": \"nsawant\",\"k\": \"begin-query\",\"v\": {\"protocol\": \"c4561a0\",\"query\": \"(restrict (aggregate (select (project (table [Extract].[Extract]) (([yr:Date:ok] (year [Date])) ([none:Region:nk] [Region]) ([none:Country / Region:nk] [Country / Region]))) (= [none:Region:nk] Asia))(([none: Country / Region: nk][none: Country / Region: nk]))(([avg: P: Population(count): ok](average[P: Population(count)]))))([none: Country / Region: nk][avg: P: Population(count): ok]))\"}}" | fields f | spath input=f | fields - f
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Mon, 11 Jan 2016 04:21:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164095#M33239</guid>
      <dc:creator>jmeyers_splunk</dc:creator>
      <dc:date>2016-01-11T04:21:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164096#M33240</link>
      <description>&lt;P&gt;Which props.conf needs to be updates since there seems to be lots of them?&lt;/P&gt;</description>
      <pubDate>Thu, 14 Jan 2016 16:29:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164096#M33240</guid>
      <dc:creator>demodav</dc:creator>
      <dc:date>2016-01-14T16:29:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164097#M33241</link>
      <description>&lt;P&gt;any props.conf will work.  Splunk merges all of them together based on rules of precendence (described here: &lt;A href="http://docs.splunk.com/Documentation/Splunk/6.1/Admin/Wheretofindtheconfigurationfiles" target="_blank"&gt;http://docs.splunk.com/Documentation/Splunk/6.1/Admin/Wheretofindtheconfigurationfiles&lt;/A&gt;).&lt;/P&gt;

&lt;P&gt;typically in a new install where you are trying to get familiar with splunk, you will make your changes in either $SPLUNK_HOME/etc/system/local/props.conf OR $SPLUNK_HOME/etc/apps/search/local/props.conf.&lt;/P&gt;

&lt;P&gt;in production, these will often be placed in a purpose built custom apps local or default props.conf file.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 08:23:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164097#M33241</guid>
      <dc:creator>jmeyers_splunk</dc:creator>
      <dc:date>2020-09-29T08:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164098#M33242</link>
      <description>&lt;P&gt;I downvoted this post because kv_mode is used for search-time field extractions only&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2016 04:54:44 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164098#M33242</guid>
      <dc:creator>aledantas2k12</dc:creator>
      <dc:date>2016-03-09T04:54:44Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164099#M33243</link>
      <description>&lt;P&gt;Not exactly sure why that warranted a down vote, as search-time extractions are pretty normal in Splunk and the question didn't call specifically for indexed extractions...furthermore indexed extractions are generally &lt;EM&gt;not&lt;/EM&gt; recommended. Both answers are technically valid.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 20:46:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164099#M33243</guid>
      <dc:creator>mikemishou</dc:creator>
      <dc:date>2016-03-15T20:46:28Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164100#M33244</link>
      <description>&lt;P&gt;I have another piece of information about this. If you want to use routing via a Heavy Forwarder, DON'T use INDEXED_EXTRACTIONS for the time being for any events you want to route. It doesn't work because of the way the pipeline operates. There is an open SPL on this which I am informed is not going to be fixed any time soon. Found out the hard way...&lt;BR /&gt;
SPL-98594   Routing events to two different groups not working as expected.&lt;/P&gt;</description>
      <pubDate>Tue, 15 Mar 2016 23:16:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164100#M33244</guid>
      <dc:creator>cmeo</dc:creator>
      <dc:date>2016-03-15T23:16:11Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164101#M33245</link>
      <description>&lt;P&gt;I down voted because he said to use KV_MODE = json during index time. &lt;BR /&gt;
Can you really use KV_MODE = json during index time?????&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:07:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164101#M33245</guid>
      <dc:creator>aledantas2k12</dc:creator>
      <dc:date>2020-09-29T09:07:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164102#M33246</link>
      <description>&lt;P&gt;Ah, you're right! I thought he was saying to do &lt;EM&gt;search-time extractions&lt;/EM&gt; with KV_MODE = json, not index-time. My mistake.&lt;/P&gt;</description>
      <pubDate>Mon, 21 Mar 2016 14:39:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164102#M33246</guid>
      <dc:creator>mikemishou</dc:creator>
      <dc:date>2016-03-21T14:39:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164103#M33247</link>
      <description>&lt;P&gt;Bumping this topic again. Why? Because Answers seems to be fairly evenly divided between use INDEXED_EXTRACTIONS and don't.&lt;/P&gt;

&lt;P&gt;Here is someone who has actually benchmarked them both:&lt;/P&gt;

&lt;P&gt;&lt;A href="https://www.hurricanelabs.com/blog/splunk-case-study-indexed-extractions-vs-search-time-extractions" target="_blank"&gt;https://www.hurricanelabs.com/blog/splunk-case-study-indexed-extractions-vs-search-time-extractions&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;So thank you Ryan for laying out the issues in the most detail I've seen so far.&lt;BR /&gt;
Upside of INDEXED_EXTRACTIONS: improved performance with some scenarios; note he uses the :: operator, not "="&lt;BR /&gt;
Downside: increased resource usage and perhaps greatly increased disk usage (stands to reason); and, as I discovered, no HF routing for any sourcetype processed this way.&lt;/P&gt;

&lt;P&gt;So you need to consider your use case carefully. In the past, and in the absence of this information, I would have gone INDEXED_EXTRACTIONS because it's easy and very reliable. Now I think I would use KV_MODE for json/XML stuff and DELIMS for CSV, unless there was a compelling reason not to.&lt;/P&gt;

&lt;P&gt;It would be great if INDEXED_EXTRACTIONS allowed you to blacklist or whitelist fieldnames or patterns to conserve resources, especially disk. Right now it doesn't.&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 15:15:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164103#M33247</guid>
      <dc:creator>cmeo</dc:creator>
      <dc:date>2020-09-29T15:15:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164104#M33248</link>
      <description>&lt;P&gt;@martin_mueller  what's the comparison between your suggestion above, and &lt;/P&gt;

&lt;P&gt;[yourSourcetype]&lt;BR /&gt;
KV_MODE=JSON &lt;/P&gt;

&lt;P&gt;on the Search Head? &lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 21:09:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164104#M33248</guid>
      <dc:creator>ridwanahmed</dc:creator>
      <dc:date>2018-11-14T21:09:56Z</dc:date>
    </item>
    <item>
      <title>Re: How to parse and extract JSON log files in Splunk?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164105#M33249</link>
      <description>&lt;P&gt;disregard; I just saw @jmeyers_splunk comment below&lt;/P&gt;</description>
      <pubDate>Wed, 14 Nov 2018 21:11:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-parse-and-extract-JSON-log-files-in-Splunk/m-p/164105#M33249</guid>
      <dc:creator>ridwanahmed</dc:creator>
      <dc:date>2018-11-14T21:11:41Z</dc:date>
    </item>
  </channel>
</rss>

