<?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: Parse JSON string with different structures in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Parse-JSON-string-with-different-structures/m-p/536057#M151554</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230192"&gt;@ashodha&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I think you see the "log" field, you can use spath like below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath input=log
| search k1="v1" K2="v2"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you an upvote is appreciated.&lt;/P&gt;</description>
    <pubDate>Fri, 15 Jan 2021 20:44:41 GMT</pubDate>
    <dc:creator>scelikok</dc:creator>
    <dc:date>2021-01-15T20:44:41Z</dc:date>
    <item>
      <title>Parse JSON string with different structures</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parse-JSON-string-with-different-structures/m-p/536055#M151552</link>
      <description>&lt;P&gt;We have Multiple apps that generate logs and there format is little different .&amp;nbsp;&lt;/P&gt;&lt;P&gt;Splunk currently just shows that field as just a string ex:&amp;nbsp;&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;id:1,&lt;/P&gt;&lt;P&gt;log:&amp;nbsp; " {k1:v1,K2:v2}"&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;The K1 and K2 are not searchable.&lt;/P&gt;&lt;P&gt;log can have different format messages but we want all of them to be searchable.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 20:40:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parse-JSON-string-with-different-structures/m-p/536055#M151552</guid>
      <dc:creator>ashodha</dc:creator>
      <dc:date>2021-01-15T20:40:08Z</dc:date>
    </item>
    <item>
      <title>Re: Parse JSON string with different structures</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parse-JSON-string-with-different-structures/m-p/536057#M151554</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/230192"&gt;@ashodha&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;I think you see the "log" field, you can use spath like below;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath input=log
| search k1="v1" K2="v2"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;If this reply helps you an upvote is appreciated.&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 20:44:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parse-JSON-string-with-different-structures/m-p/536057#M151554</guid>
      <dc:creator>scelikok</dc:creator>
      <dc:date>2021-01-15T20:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Parse JSON string with different structures</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Parse-JSON-string-with-different-structures/m-p/536061#M151557</link>
      <description>&lt;LI-CODE lang="markup"&gt;index=_internal | head 1 | fields _raw
| eval _raw="{\"id\":1,\"log\":\"\\\"{k1:v1,K2:v2}\\\"\"}"
| eval data=_raw
| rename COMMENT as "this is sample"
| spath input=data
| rex field=log mode=sed "s/(?&amp;lt;key&amp;gt;\w+):\s*(?&amp;lt;value&amp;gt;\w+)/\"\1\":\"\2\"/g s/\"(.*)\"/\1/"
| spath input=log
| search k1="v1"&lt;/LI-CODE&gt;&lt;P&gt;&lt;SPAN&gt;It might be a little annoying.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Fri, 15 Jan 2021 21:38:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Parse-JSON-string-with-different-structures/m-p/536061#M151557</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2021-01-15T21:38:28Z</dc:date>
    </item>
  </channel>
</rss>

