<?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 display JSON map as a single multi-value field instead of multiple auto-discovered fields? in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/523457#M88394</link>
    <description>&lt;P&gt;How would you write the foreach statement if the parameters didn't share a name prefix like this: ?&lt;/P&gt;&lt;PRE&gt;| eval js="{\"parameters\": {\"wookie\": \"1\",\"jabba\": \"2\"}}"&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 07 Oct 2020 15:16:32 GMT</pubDate>
    <dc:creator>esalesap</dc:creator>
    <dc:date>2020-10-07T15:16:32Z</dc:date>
    <item>
      <title>How to display JSON map as a single multi-value field instead of multiple auto-discovered fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/389367#M69690</link>
      <description>&lt;P&gt;Hello,&lt;/P&gt;

&lt;P&gt;I have an input module that injects data as _json source type.&lt;BR /&gt;
In each event I have a field named "parameters" that contains a map (key-value entries) like this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;"parameters": {
   "parameter-a": "1",
   "parameter-b": "2",
   ...
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I don't know the map keys, they may correlate between events but are not consistent.&lt;BR /&gt;
Splunk automatically extracts them as "parameters.parameter-a" and "parameters.parameter-b" fields and this is not what I want.&lt;BR /&gt;
It would rather have a multi-value field named "parameters" with each line containing both key and value like:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;parameter-a=1
parameter-b=2
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| spath output=parameters path=parameters
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get a field that contains a raw JSON value of the "parameters" field (with brackets, quotes and commas).&lt;BR /&gt;
When I use:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| spath output=parameters path=parameters{}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I get empty field values.&lt;BR /&gt;
Is there a way to do what I want?&lt;/P&gt;

&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Wed, 20 Jun 2018 12:04:19 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/389367#M69690</guid>
      <dc:creator>sbarinov</dc:creator>
      <dc:date>2018-06-20T12:04:19Z</dc:date>
    </item>
    <item>
      <title>Re: How to display JSON map as a single multi-value field instead of multiple auto-discovered fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/389368#M69691</link>
      <description>&lt;P&gt;Hello @sbarinov,&lt;/P&gt;

&lt;P&gt;please try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval js="{\"parameters\": {\"parameter-a\": \"1\",\"parameter-b\": \"2\"}}"
| spath input=js path=parameters output=someOtherField
| spath input=someOtherField
| foreach parameter* [eval parameters=mvappend(parameters, '&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')]
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 21 Jun 2018 12:44:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/389368#M69691</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2018-06-21T12:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to display JSON map as a single multi-value field instead of multiple auto-discovered fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/389369#M69692</link>
      <description>&lt;P&gt;Thank you.&lt;/P&gt;</description>
      <pubDate>Fri, 22 Jun 2018 07:44:14 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/389369#M69692</guid>
      <dc:creator>sbarinov</dc:creator>
      <dc:date>2018-06-22T07:44:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to display JSON map as a single multi-value field instead of multiple auto-discovered fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/389370#M69693</link>
      <description>&lt;P&gt;Welcome ! Any time.&lt;/P&gt;</description>
      <pubDate>Wed, 25 Sep 2019 05:09:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/389370#M69693</guid>
      <dc:creator>poete</dc:creator>
      <dc:date>2019-09-25T05:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to display JSON map as a single multi-value field instead of multiple auto-discovered fields?</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/523457#M88394</link>
      <description>&lt;P&gt;How would you write the foreach statement if the parameters didn't share a name prefix like this: ?&lt;/P&gt;&lt;PRE&gt;| eval js="{\"parameters\": {\"wookie\": \"1\",\"jabba\": \"2\"}}"&amp;nbsp;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Oct 2020 15:16:32 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-display-JSON-map-as-a-single-multi-value-field-instead-of/m-p/523457#M88394</guid>
      <dc:creator>esalesap</dc:creator>
      <dc:date>2020-10-07T15:16:32Z</dc:date>
    </item>
  </channel>
</rss>

