<?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 retrieve multiple fields from JSON data as one list? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-multiple-fields-from-JSON-data-as-one-list/m-p/351432#M104012</link>
    <description>&lt;P&gt;We feed JSON data into our Splunk index. It is not a flat JSON, but has a couple of levels of nested-ness. For instance:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    id: "some_id",
    main_error_string: "something bad happened",
    details: {
        other_severe_error_strings: ["verybad1", "verybad2", "verybad3"],
        other_mild_error_strings: ["bad1", "bad2", "bad3"]
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What we now want to do is collect all the error messages from these different fields like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;'main_error_string', 'details.other_severe_error_strings', 'details.other_mild_error_strings'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;etc. into one huge list of strings.&lt;/P&gt;

&lt;P&gt;Our ultimate goal is to then feed this list of strings into an unsupervised text classifier engine to see what all clusters come out of the various error strings.&lt;/P&gt;

&lt;P&gt;So the question is - what Splunk query do I write to flatten those different JSON fields (of different types - string and list of strings) and in different hierarchies into one list of strings?&lt;/P&gt;</description>
    <pubDate>Mon, 12 Jun 2017 23:22:42 GMT</pubDate>
    <dc:creator>shikhanshu</dc:creator>
    <dc:date>2017-06-12T23:22:42Z</dc:date>
    <item>
      <title>How to retrieve multiple fields from JSON data as one list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-multiple-fields-from-JSON-data-as-one-list/m-p/351432#M104012</link>
      <description>&lt;P&gt;We feed JSON data into our Splunk index. It is not a flat JSON, but has a couple of levels of nested-ness. For instance:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    id: "some_id",
    main_error_string: "something bad happened",
    details: {
        other_severe_error_strings: ["verybad1", "verybad2", "verybad3"],
        other_mild_error_strings: ["bad1", "bad2", "bad3"]
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;What we now want to do is collect all the error messages from these different fields like &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;'main_error_string', 'details.other_severe_error_strings', 'details.other_mild_error_strings'
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;etc. into one huge list of strings.&lt;/P&gt;

&lt;P&gt;Our ultimate goal is to then feed this list of strings into an unsupervised text classifier engine to see what all clusters come out of the various error strings.&lt;/P&gt;

&lt;P&gt;So the question is - what Splunk query do I write to flatten those different JSON fields (of different types - string and list of strings) and in different hierarchies into one list of strings?&lt;/P&gt;</description>
      <pubDate>Mon, 12 Jun 2017 23:22:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-multiple-fields-from-JSON-data-as-one-list/m-p/351432#M104012</guid>
      <dc:creator>shikhanshu</dc:creator>
      <dc:date>2017-06-12T23:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve multiple fields from JSON data as one list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-multiple-fields-from-JSON-data-as-one-list/m-p/351433#M104013</link>
      <description>&lt;P&gt;Like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval this_error_string_1="1 2 3 4", another_error_strings_etc="a b c d e f g" 
| makemv this_error_string_1 
| makemv another_error_strings_etc 

| rename COMMENT AS "Everything above generates sample event data; everything below is your solution"

| eval junk="ThisFieldValueDoesNotMatter"
| stats values(*error_string*) AS *error_string* BY junk
| untable junk key values
| makemv values
| stats values(values) As error_strings
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 13 Jun 2017 00:25:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-multiple-fields-from-JSON-data-as-one-list/m-p/351433#M104013</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2017-06-13T00:25:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to retrieve multiple fields from JSON data as one list?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-multiple-fields-from-JSON-data-as-one-list/m-p/351434#M104014</link>
      <description>&lt;P&gt;Thank you! That was quite helpful.&lt;/P&gt;</description>
      <pubDate>Tue, 13 Jun 2017 16:39:17 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-retrieve-multiple-fields-from-JSON-data-as-one-list/m-p/351434#M104014</guid>
      <dc:creator>shikhanshu</dc:creator>
      <dc:date>2017-06-13T16:39:17Z</dc:date>
    </item>
  </channel>
</rss>

