<?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: JSON vector of vector in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546229#M154834</link>
    <description>&lt;P&gt;The development area did was send all the logs of a solution implemented as microservices to a database, that is why a JSON contains other JSON since they are different types of logs within a JSON&lt;/P&gt;</description>
    <pubDate>Wed, 31 Mar 2021 14:32:01 GMT</pubDate>
    <dc:creator>splunkcol</dc:creator>
    <dc:date>2021-03-31T14:32:01Z</dc:date>
    <item>
      <title>JSON vector of vector</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/544977#M154325</link>
      <description>&lt;P&gt;I have a data source which I collect using DB CONNECT from an oracle database which brings the information in JSON format, but I see that the use of regular expressions is not successful, neither is the field extraction assistant.&lt;/P&gt;&lt;P&gt;The problem is because it is a vector of vectors, it is a vector that within each log in JSON format this in turn has more JSON logs&lt;/P&gt;&lt;P&gt;Someone something similar happened to him?&lt;/P&gt;</description>
      <pubDate>Tue, 23 Mar 2021 18:09:35 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/544977#M154325</guid>
      <dc:creator>splunkcol</dc:creator>
      <dc:date>2021-03-23T18:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: JSON vector of vector</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/545766#M154672</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223770"&gt;@splunkcol&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Can you provide an example of how the JSON is nested? I interpret "vector" as an array, but I think you may mean objects escaped as string values in a parent object:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"foo": "{\"bar\": \"baz\"}"}&lt;/LI-CODE&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"bar": "baz"}&lt;/LI-CODE&gt;&lt;P&gt;In this case, you can use e.g.:&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;| spath input=foo
| table bar&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 17:35:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/545766#M154672</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2021-03-28T17:35:42Z</dc:date>
    </item>
    <item>
      <title>Re: JSON vector of vector</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/545777#M154676</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Hello, this is one of the logs&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="splunkcol_0-1616965927856.png" style="width: 999px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/13518i08F95C0CCD8BABF6/image-size/large?v=v2&amp;amp;px=999" role="button" title="splunkcol_0-1616965927856.png" alt="splunkcol_0-1616965927856.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sun, 28 Mar 2021 21:13:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/545777#M154676</guid>
      <dc:creator>splunkcol</dc:creator>
      <dc:date>2021-03-28T21:13:00Z</dc:date>
    </item>
    <item>
      <title>Re: JSON vector of vector</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546062#M154770</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;could you help me with this case?&lt;/P&gt;</description>
      <pubDate>Tue, 30 Mar 2021 18:53:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546062#M154770</guid>
      <dc:creator>splunkcol</dc:creator>
      <dc:date>2021-03-30T18:53:38Z</dc:date>
    </item>
    <item>
      <title>Re: JSON vector of vector</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546135#M154796</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223770"&gt;@splunkcol&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;no I didn't encountered this problem: it's the first time that I hear of a DB that exports data in JSON.&lt;/P&gt;&lt;P&gt;Anyway, I'd try to use in a different way the DB-Connect: do you export a full table or a query result?&lt;/P&gt;&lt;P&gt;Maybe using a query you have a table to manage in the usual way.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 06:36:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546135#M154796</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2021-03-31T06:36:41Z</dc:date>
    </item>
    <item>
      <title>Re: JSON vector of vector</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546229#M154834</link>
      <description>&lt;P&gt;The development area did was send all the logs of a solution implemented as microservices to a database, that is why a JSON contains other JSON since they are different types of logs within a JSON&lt;/P&gt;</description>
      <pubDate>Wed, 31 Mar 2021 14:32:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546229#M154834</guid>
      <dc:creator>splunkcol</dc:creator>
      <dc:date>2021-03-31T14:32:01Z</dc:date>
    </item>
    <item>
      <title>Re: JSON vector of vector</title>
      <link>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546452#M154919</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/223770"&gt;@splunkcol&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You're up against a few different problems.&lt;/P&gt;&lt;P&gt;First, recent versions of Splunk DB Connect do not escape quotes and backslashes in field values. In prior version of DB Connect--those that wrote data to temporary files instead of HEC--the quote and backslash characters were escaped:&lt;/P&gt;&lt;P&gt;"COLUMN_NAME"="This is a column \"value\" with escaped quotes."&lt;/P&gt;&lt;P&gt;In this case, the source type could be configured to properly interpret the strings at search time:&lt;/P&gt;&lt;P&gt;# props.conf&lt;BR /&gt;[my_source_type]&lt;BR /&gt;KV_MODE = auto_escaped&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;COLUMN_NAME&lt;/STRONG&gt;&lt;BR /&gt;This is a column "value" with escaped quotes.&lt;/P&gt;&lt;P&gt;DB Connect now outputs:&lt;/P&gt;&lt;P&gt;COLUMN_NAME="This is not a column "value" with escaped quotes."&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;COLUMN_NAME&lt;/STRONG&gt;&lt;BR /&gt;This is not a column&amp;nbsp;&lt;/P&gt;&lt;P&gt;(With a trailing space in the value.)&lt;/P&gt;&lt;P&gt;The typical way to work around this is in your SQL query (using REPLACE in this example for SQL dialects that support it):&lt;/P&gt;&lt;P&gt;SELECT REPLACE(REPLACE(COLUMN_NAME, '\', '\\'), '"', '\"') COLUMN_NAME&lt;BR /&gt;FROM FOO&lt;BR /&gt;WHERE BAR &amp;gt; ?&lt;BR /&gt;ORDER BY BAR ASC&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;COLUMN_NAME&lt;/STRONG&gt;&lt;BR /&gt;This is a column \"value\" with escaped quotes.&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;"COLUMN_NAME"="This is a column \"value\" with escaped quotes."&lt;/P&gt;&lt;P&gt;Second, your column contains an outer JSON object. Here's an example with proper escape sequences:&lt;/P&gt;&lt;P&gt;"COLUMN_NAME"="[{\"foo\":\"bar\"},{\"foo\":\"baz\"}]"&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;COLUMN_NAME&lt;/STRONG&gt;&lt;BR /&gt;[{"foo":"bar"},{"foo":"baz"}]&lt;/P&gt;&lt;P&gt;If the outer JSON is properly formatted, it's simple enough to parse the field:&lt;/P&gt;&lt;P&gt;| spath input=COLUMN_NAME&lt;/P&gt;&lt;P&gt;From there, you can find and parse any fields containing nested JSON:&lt;/P&gt;&lt;P&gt;"COLUMN_NAME"="[{\"foo\":\"{\\\"bar\\\":\\\"baz\\\"}\"},{\"foo\":\"{\\\"bar\\\":\\\"qux\\\"}\"}]"&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;COLUMN_NAME&lt;/STRONG&gt;&lt;BR /&gt;[{"foo":"{\"bar\":\"baz\"}"},{"foo":"{\"bar\":\"qux\"}"}]&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;| spath input=COLUMN_NAME&lt;BR /&gt;| mvexpand {}.foo&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{}.foo&lt;/STRONG&gt;&lt;BR /&gt;{"bar":"baz"}&lt;BR /&gt;{"bar":"qux"}&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;| spath input={}.foo&lt;/P&gt;&lt;P&gt;=&amp;gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;bar&lt;/STRONG&gt;&lt;BR /&gt;baz&lt;BR /&gt;qux&lt;/P&gt;&lt;P&gt;Finally, the JSON value in your database column appears to be malformed. Paraphrasing:&lt;/P&gt;&lt;P&gt;MESSAGE_JSON="[{"key":"Rxxxs","name":"Cxxxs:{\"txxxd":\"4xxx2\",...\"}}"}]"&lt;/P&gt;&lt;P&gt;Even properly escaped, the value after Cxxxs: is an invalid JSON object:&lt;/P&gt;&lt;P&gt;{\"txxxd":\"4xxx2\",...\"}&lt;/P&gt;&lt;P&gt;Notice the inconsistency in escape sequences where a plain quote follows an escaped quote.&lt;/P&gt;&lt;P&gt;Before you go any further, take a closer look at the value of MESSAGE_JSON in the database. If some or all of the value can be correctly parsed as JSON, then it can be properly escaped in the SQL query and in turn properly parsed in Splunk.&lt;/P&gt;&lt;P&gt;If you can post an example of the complete MESSAGE_JSON value in text with obfuscated keys and strings rather than an image, we can provide more insight.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 23:42:42 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/JSON-vector-of-vector/m-p/546452#M154919</guid>
      <dc:creator>tscroggins</dc:creator>
      <dc:date>2021-04-01T23:42:42Z</dc:date>
    </item>
  </channel>
</rss>

