<?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 extract nested JSON and display JsonObject in a table? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445013#M126217</link>
    <description>&lt;P&gt;I tried your options, but the request/response is not displayed as one single column, each json element is displayed in its own column. &lt;/P&gt;

&lt;P&gt;Is there a way that i can convert the extracted Json back to String and display(request/response) in one single Column?&lt;/P&gt;</description>
    <pubDate>Wed, 03 Jul 2019 18:14:56 GMT</pubDate>
    <dc:creator>Dhanapathi</dc:creator>
    <dc:date>2019-07-03T18:14:56Z</dc:date>
    <item>
      <title>How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445005#M126209</link>
      <description>&lt;P&gt;My sample event looks like below:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
    "thread": "http-nio-8085-exec-1",
    "level": "INFO",
    "loggerName": "INSTRUMENTATION_TRACING",
    "message": {
        "eventId": "68b3c5d3-02e5-4c33-af41-756b43fc4311",
        "signature": "public ResponseObj someMethod(RequestObj)",
        "duration": 1019,
        "request": [{"#my nested request Json goes here": "" } ],
        "response": {"#my nested response Json goes here": ""},
    "endOfBatch": false,
    "loggerFqcn": "org.apache.logging.log4j.spi.AbstractLogger",
    "instant": {
        "epochSecond": 1561664957,
        "nanoOfSecond": 437000000
    },
    "threadId": 26,
    "threadPriority": 5
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I would like to display in a table like below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eventId | signature | duration | request | response
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Issue&lt;/STRONG&gt;: I was able to extract each element in a nested JSON but the cloud is not able to aggregate 'message.request' as one JSON String&lt;BR /&gt;
&lt;STRONG&gt;Tried below&lt;/STRONG&gt; :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=sample loggerName="INSTRUMENTATION_TRACING" | spath | rename message.eventId as eventId, message.signature as signature message.duration as duration , message.request as request, message.response as response | table eventId, signature, duration, request, response
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;spath extracts all nested elements as expected. I could not see "message.request" or "message.response" in the extracted fields. &lt;/P&gt;

&lt;P&gt;I only want to extract one level (i.e I want message.request and message.response elements as Json string to display in  a table)&lt;/P&gt;

&lt;P&gt;Is it possible? If so, can someone throw me some ideas, please.&lt;/P&gt;</description>
      <pubDate>Fri, 28 Jun 2019 16:23:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445005#M126209</guid>
      <dc:creator>Dhanapathi</dc:creator>
      <dc:date>2019-06-28T16:23:03Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445006#M126210</link>
      <description>&lt;P&gt;@Dhanapathi &lt;/P&gt;

&lt;P&gt;Can you please share sample JSON for &lt;CODE&gt;"request": [{"#my nested request Json goes here": "" } ],&lt;BR /&gt;
         "response": {"#my nested response Json goes here": ""},&lt;/CODE&gt; and expected result from it?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 04:58:50 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445006#M126210</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-07-01T04:58:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445007#M126211</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;{
    "eventId": "1065f4a2-d61d-438d-9862-6db0c41b5000",
    "metrics": {
        "NAME": "pilot-vehicle-service",
        "VERSION": "1.0",
        "ENVIRONMENT": "DEV",
        "INSTANCE_ID": "11",
        "CORRELATION_ID": "3259eef8-afab-4cf1-a8c3-20ed9682aefe",
        "LOCAL_ADDRESS": "127.0.0.1:8080 ",
        "REMOTE_ADDRESS": "127.0.0.1",
        "URI": "[POST]/pilot-vehicle-service/0.0/vehicle/preference"
    },
    "signature": "public me.dhana.poc.vehicle.domain.Vehicle me.dhana.poc.vehicle.service.impl.DefaultVehicleQueryService.getPreference(me.dhana.poc.vehicle.domain.Category)",
    "duration": 343,
    "request": [
        {
            "segment": "compact",
            "type": "suv"
        }
    ],
    "response": {
        "id": "5",
        "manufacturer": "Honda",
        "year": 2017,
        "model": "Pilot",
        "price": 13300
    }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Please find the sample above&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 15:55:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445007#M126211</guid>
      <dc:creator>Dhanapathi</dc:creator>
      <dc:date>2019-07-01T15:55:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445008#M126212</link>
      <description>&lt;P&gt;Is that the formatted JSON (i.e. coming from Splunk display) or does your event have the whitespaces and newlines in it?&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 16:40:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445008#M126212</guid>
      <dc:creator>memarshall63</dc:creator>
      <dc:date>2019-07-01T16:40:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445009#M126213</link>
      <description>&lt;P&gt;I will have whitespaces  and newlines in my Splunk log event. The Json content of request  and response changes based on the operation&lt;/P&gt;</description>
      <pubDate>Mon, 01 Jul 2019 19:30:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445009#M126213</guid>
      <dc:creator>Dhanapathi</dc:creator>
      <dc:date>2019-07-01T19:30:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445010#M126214</link>
      <description>&lt;P&gt;Below SPL works for 'request' field as the field is a 'list' in the JSON input. &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|&amp;lt;base_search&amp;gt;
| spath output=request path=request{}
| table eventId, signature, duration, request
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 02 Jul 2019 06:54:51 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445010#M126214</guid>
      <dc:creator>jawaharas</dc:creator>
      <dc:date>2019-07-02T06:54:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445011#M126215</link>
      <description>&lt;P&gt;@Dhanapathi&lt;/P&gt;

&lt;P&gt;I assume that this event from the search bar.&lt;/P&gt;

&lt;P&gt;Can you please execute below searches?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=sample loggerName="INSTRUMENTATION_TRACING" | spath 
| rename message.* as * | table  eventId, signature, duration, request{}*, response.*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Sample Search:&lt;/STRONG&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="{
    \"thread\": \"http-nio-8085-exec-1\",
    \"level\": \"INFO\",
    \"loggerName\": \"INSTRUMENTATION_TRACING\",
    \"message\": {
        \"eventId\": \"1065f4a2-d61d-438d-9862-6db0c41b5000\",
        \"metrics\": {
            \"NAME\": \"pilot-vehicle-service\",
            \"VERSION\": \"1.0\",
            \"ENVIRONMENT\": \"DEV\",
            \"INSTANCE_ID\": \"11\",
            \"CORRELATION_ID\": \"3259eef8-afab-4cf1-a8c3-20ed9682aefe\",
            \"LOCAL_ADDRESS\": \"127.0.0.1:8080 \",
            \"REMOTE_ADDRESS\": \"127.0.0.1\",
            \"URI\": \"[POST]/pilot-vehicle-service/0.0/vehicle/preference\"
        },
        \"signature\": \"public me.dhana.poc.vehicle.domain.Vehicle me.dhana.poc.vehicle.service.impl.DefaultVehicleQueryService.getPreference(me.dhana.poc.vehicle.domain.Category)\",
        \"duration\": 343,
        \"request\": [{
            \"segment\": \"compact\",
            \"type\": \"suv\"
        },{
            \"segment\": \"compact1\",
            \"type\": \"suv1\"
        }],
        \"response\": {
            \"id\": \"5\",
            \"manufacturer\": \"Honda\",
            \"year\": 2017,
            \"model\": \"Pilot\",
            \"price\": 13300
        }
    }
}" 
| spath
| rename message.* as * | table  eventId, signature, duration, request{}*, response.*
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;Note:&lt;/STRONG&gt; in your JSON &lt;CODE&gt;request&lt;/CODE&gt; is array type of object So multivalued field could found. See in sample search. &lt;/P&gt;</description>
      <pubDate>Tue, 02 Jul 2019 08:33:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445011#M126215</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2019-07-02T08:33:29Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445012#M126216</link>
      <description>&lt;P&gt;Sorry.., I need to display both request and response&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 18:10:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445012#M126216</guid>
      <dc:creator>Dhanapathi</dc:creator>
      <dc:date>2019-07-03T18:10:24Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract nested JSON and display JsonObject in a table?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445013#M126217</link>
      <description>&lt;P&gt;I tried your options, but the request/response is not displayed as one single column, each json element is displayed in its own column. &lt;/P&gt;

&lt;P&gt;Is there a way that i can convert the extracted Json back to String and display(request/response) in one single Column?&lt;/P&gt;</description>
      <pubDate>Wed, 03 Jul 2019 18:14:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-extract-nested-JSON-and-display-JsonObject-in-a-table/m-p/445013#M126217</guid>
      <dc:creator>Dhanapathi</dc:creator>
      <dc:date>2019-07-03T18:14:56Z</dc:date>
    </item>
  </channel>
</rss>

