<?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: extract message field from JSON in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424949#M121846</link>
    <description>&lt;P&gt;You can also use the below mentioned regex, there are two regex, one captures everything after msg and other captures only till email, try this and let me know if it works for you.&lt;/P&gt;

&lt;P&gt;yourBaseQuery&lt;BR /&gt;
 |rex "\msg:\s+(?.*)"&lt;BR /&gt;
 | complete your search&lt;/P&gt;

&lt;P&gt;yourBaseQuery&lt;BR /&gt;
| rex \msg:\s+(?\w+-\w+-\w+:\w+:\w+.\w+\s+\w+)&lt;BR /&gt;
 | complete your search&lt;/P&gt;</description>
    <pubDate>Tue, 10 Jul 2018 10:26:03 GMT</pubDate>
    <dc:creator>manish_singh_77</dc:creator>
    <dc:date>2018-07-10T10:26:03Z</dc:date>
    <item>
      <title>extract message field from JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424947#M121844</link>
      <description>&lt;P&gt;trying to extract the msg field from an azure blob which uses the _json sourcetype - the msg : field shows as one long field - how to extract this please ?&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;msg:    2018-07-10T06:53:42.803Z email|5b3c37d::Rules::ValidateUser:: ::BEGIN-RULE::&lt;BR /&gt;
Validate - user {"_id":"25fd57973c","email":"blah@hotmail.com","email_verified":true,"clientID":"8NReZXmds4","updated_at":"2018-07-10T06:53:42.764Z","name":"blah@hotmail.com","picture":"https://web.png","user_id":"email|5b3c37dd","nickname":"nickname","identities":[{"user_id":"5b3c3","provider":"email","connection":"email","isSocial":false}],"created_at":"2018-07-04T02:58:55.014Z","user_metadata":{"firstname":"bob","lastname":"bob","name":"bob bob"},"global_client_id":"rEJsAkwGVI","app_metadata":{"client_info":{"MyAccount":{"first_login_time":"2018-07-04T02:58:55.422Z","count":7,"last_login_time":"2018-07-10T06:49:40.126Z","user_id":"a0uid_xxxxx"}}},"client_info":{"MyAccount":{"first_login_time":"2018-07-04T02:58:55.422Z","count":7,"last_login_time":"2018-07-10T06:49:40.126Z","user_id":"a0uid_46"}},"persistent":{}}&lt;/CODE&gt; &lt;/P&gt;

&lt;P&gt;thanks&lt;/P&gt;

&lt;P&gt;*** UPDATE *** &lt;/P&gt;

&lt;P&gt;So i've made some progress where i can create a new_msg field stripping off the non-json part of the msg field : &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;2018-07-10T06:53:42.803Z email|5b3c37d::Rules::ValidateUser:: ::BEGIN-RULE::Validate - user&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;and then that allows me to run spath on the new_msg&lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;| rex field=msg "^[^{]+(?&amp;lt;new_msg&amp;gt;.*)" | spath input=new_msg&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;now my field count has gone from ~50 to 500+ &lt;/P&gt;

&lt;P&gt;Is there a better way ?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 07:41:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424947#M121844</guid>
      <dc:creator>Esky73</dc:creator>
      <dc:date>2018-07-10T07:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: extract message field from JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424948#M121845</link>
      <description>&lt;P&gt;Pls try this in your search and let me know..&lt;/P&gt;

&lt;P&gt;extract pairdelim=",", kvdelim='":"'&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 09:56:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424948#M121845</guid>
      <dc:creator>manish_singh_77</dc:creator>
      <dc:date>2018-07-10T09:56:11Z</dc:date>
    </item>
    <item>
      <title>Re: extract message field from JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424949#M121846</link>
      <description>&lt;P&gt;You can also use the below mentioned regex, there are two regex, one captures everything after msg and other captures only till email, try this and let me know if it works for you.&lt;/P&gt;

&lt;P&gt;yourBaseQuery&lt;BR /&gt;
 |rex "\msg:\s+(?.*)"&lt;BR /&gt;
 | complete your search&lt;/P&gt;

&lt;P&gt;yourBaseQuery&lt;BR /&gt;
| rex \msg:\s+(?\w+-\w+-\w+:\w+:\w+.\w+\s+\w+)&lt;BR /&gt;
 | complete your search&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 10:26:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424949#M121846</guid>
      <dc:creator>manish_singh_77</dc:creator>
      <dc:date>2018-07-10T10:26:03Z</dc:date>
    </item>
    <item>
      <title>Re: extract message field from JSON</title>
      <link>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424950#M121847</link>
      <description>&lt;P&gt;both of these errored with Regex: unrecognized character follows \&lt;/P&gt;

&lt;P&gt;I have updated my progress above. TY&lt;/P&gt;</description>
      <pubDate>Tue, 10 Jul 2018 12:55:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/extract-message-field-from-JSON/m-p/424950#M121847</guid>
      <dc:creator>Esky73</dc:creator>
      <dc:date>2018-07-10T12:55:00Z</dc:date>
    </item>
  </channel>
</rss>

