<?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 Json from a log in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/Extract-Json-from-a-log/m-p/468148#M80618</link>
    <description>&lt;P&gt;I reached to extract json using a regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mtd" sourcetype="mtd" 
| rex "[^\{]*(?&amp;lt;all&amp;gt;.*)"
| spath input=all
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But i cannot use this search in Datamodel.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Fri, 03 Apr 2020 15:21:03 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2020-04-03T15:21:03Z</dc:date>
    <item>
      <title>Extract Json from a log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-Json-from-a-log/m-p/468147#M80617</link>
      <description>&lt;P&gt;Hi at all,&lt;BR /&gt;
I'm finding problems extracting fields from a json log using spath, I cannot use regexes because I have to use these fields in the Zimperium App Datamodel.&lt;BR /&gt;
I already extracted json, but I don't know why I'm finding problems.&lt;/P&gt;

&lt;P&gt;This is a sample:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;&amp;lt;14&amp;gt;1 04 02 2020 17:02:22 UTC zconsole-xxxxxxxxxx-xxx44 {"system_token": "company-uat", "severity": 1, "event_id": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "forensics": {"zdid": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "event_id": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "os": 1, "attack_time": {"$date": 1585846942000}, "general": [{"name": "Threat Type", "val": "DORMANT"}, {"name": "Action Triggered", "val": ""}], "threat_uuid": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "type": 100}, "mitigated": false, "location": null, "eventtimestamp": "04 02 2020 17:02:22 UTC", "user_info": {"employee_name": "User03 Test", "user_id": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "user_role": "End User", "user_email": "test.user03@company.com", "user_group": "__MTD_UAT"}, "device_info": {"tag1": "", "device_time": "03 30 2020 17:01:31 UTC", "app_version": "10.5.1.0.52R", "zdid": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "tag2": "", "os": "Android", "app": "MobileIron", "jailbroken": false, "operator": null, "os_version": "9", "mdm_id": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "imei": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "model": "SM-A530F", "device_id": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx", "type": "jackpotltexx", "zapp_instance_id": "xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx"}, "threat": {"story": "Inactive Device", "name": "Inactive Device", "general": {"action_triggered": "", "threat_type": "DORMANT"}}}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;if I use the spath command I have an additional field called "14" containing all the event.&lt;/P&gt;

&lt;P&gt;Problems started from the ingestion, because this log isn't recognized al json the guided ingestion.&lt;/P&gt;

&lt;P&gt;Can anyone give me an idea how to do this?&lt;/P&gt;

&lt;P&gt;Thank you in advance.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 15:02:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-Json-from-a-log/m-p/468147#M80617</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-04-03T15:02:48Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Json from a log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-Json-from-a-log/m-p/468148#M80618</link>
      <description>&lt;P&gt;I reached to extract json using a regex:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="mtd" sourcetype="mtd" 
| rex "[^\{]*(?&amp;lt;all&amp;gt;.*)"
| spath input=all
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But i cannot use this search in Datamodel.&lt;/P&gt;

&lt;P&gt;Ciao.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 15:21:03 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-Json-from-a-log/m-p/468148#M80618</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2020-04-03T15:21:03Z</dc:date>
    </item>
    <item>
      <title>Re: Extract Json from a log</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/Extract-Json-from-a-log/m-p/468149#M80619</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="&amp;lt;14&amp;gt;1 04 02 2020 17:02:22 UTC zconsole-xxxxxxxxxx-xxx44 {\"system_token\": \"company-uat\", \"severity\": 1, \"event_id\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"forensics\": {\"zdid\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"event_id\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"os\": 1, \"attack_time\": {\"$date\": 1585846942000}, \"general\": [{\"name\": \"Threat Type\", \"val\": \"DORMANT\"}, {\"name\": \"Action Triggered\", \"val\": \"\"}], \"threat_uuid\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"type\": 100}, \"mitigated\": false, \"location\": null, \"eventtimestamp\": \"04 02 2020 17:02:22 UTC\", \"user_info\": {\"employee_name\": \"User03 Test\", \"user_id\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"user_role\": \"End User\", \"user_email\": \"test.user03@company.com\", \"user_group\": \"__MTD_UAT\"}, \"device_info\": {\"tag1\": \"\", \"device_time\": \"03 30 2020 17:01:31 UTC\", \"app_version\": \"10.5.1.0.52R\", \"zdid\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"tag2\": \"\", \"os\": \"Android\", \"app\": \"MobileIron\", \"jailbroken\": false, \"operator\": null, \"os_version\": \"9\", \"mdm_id\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"imei\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"model\": \"SM-A530F\", \"device_id\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\", \"type\": \"jackpotltexx\", \"zapp_instance_id\": \"xxxxxxxx-xxx-xxxx-xxxx-xxxxxxxxxxxx\"}, \"threat\": {\"story\": \"Inactive Device\", \"name\": \"Inactive Device\", \"general\": {\"action_triggered\": \"\", \"threat_type\": \"DORMANT\"}}}"
| rex mode=sed "s/.*UTC \S+ //g"
| spath
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;props.conf&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;TIME_PREFIX = \&amp;lt;\d+\&amp;gt;\d\s
TIME_FORMAT = %m %d %Y %T %Z
SEDCMD-trim = s/.*UTC \S+ //g
INDEXED_EXTRACTIONS = json
KV_MODE = none
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Hi, @gcusello &lt;BR /&gt;
I don't know if it's a data model, but usually this is fine.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Apr 2020 23:35:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/Extract-Json-from-a-log/m-p/468149#M80619</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-04-03T23:35:05Z</dc:date>
    </item>
  </channel>
</rss>

