<?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: EVAL with REX with SPATH (props / transforms) in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519426#M87832</link>
    <description>&lt;P&gt;{"log_message";"{\"version\":\"1.00000\",\"account_id\":\"12345678\",\"region\":\"myarea\",\" and so on until this blocks ends with }}".&amp;nbsp; The remainder of the log after this is parsed appropriately "log_group":"/logs","log_location":"mylogs","account_information":"38430495"} for example.&lt;/P&gt;</description>
    <pubDate>Mon, 14 Sep 2020 12:48:40 GMT</pubDate>
    <dc:creator>willadams</dc:creator>
    <dc:date>2020-09-14T12:48:40Z</dc:date>
    <item>
      <title>EVAL with REX with SPATH (props / transforms)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519352#M87827</link>
      <description>&lt;P&gt;I have a JSON file with an embedded JSON field that I am trying to extract.&amp;nbsp; I have been doing some searching and have finally come up with an SPL search that will extract the information into my relevant key pairs.&amp;nbsp; The SPL is basically&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=foo sourcetype=foosource
| eval log_message=replace(log_message, "\\\"\"","")
| rex "log_message\\\\\":\\\\\"(?&amp;lt;log_message&amp;gt;[^\\\]+)"
| spath input=log_message&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have also read that I shouldn't need the spath however if I remove this from my SPL then it doesn't extract as required.&lt;/P&gt;&lt;P&gt;I would like to put this into transforms but unsure how to apply the "spath".&amp;nbsp; Thoughts around my props/transforms so far is:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;props.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;REPORT-logmessage = log_message&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;transforms.conf&lt;/STRONG&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[log_message]
INGEST_EVAL = eval_log_message=replace(log_message=replace(log_message, "\\\"\"","")
REX = "log_message\\\\\":\\\\\"(?&amp;lt;log_message&amp;gt;[^\\\]+)"&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 08:22:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519352#M87827</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2020-09-14T08:22:36Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL with REX with SPATH (props / transforms)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519409#M87831</link>
      <description>&lt;P&gt;can you share sample event?&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 12:00:11 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519409#M87831</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-14T12:00:11Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL with REX with SPATH (props / transforms)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519426#M87832</link>
      <description>&lt;P&gt;{"log_message";"{\"version\":\"1.00000\",\"account_id\":\"12345678\",\"region\":\"myarea\",\" and so on until this blocks ends with }}".&amp;nbsp; The remainder of the log after this is parsed appropriately "log_group":"/logs","log_location":"mylogs","account_information":"38430495"} for example.&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 12:48:40 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519426#M87832</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2020-09-14T12:48:40Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL with REX with SPATH (props / transforms)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519446#M87833</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/79922"&gt;@willadams&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I can't give you exact answer for your question, but I can direct you the approach to be taken.&lt;/P&gt;&lt;P&gt;let me explain what I understand from your question:&lt;/P&gt;&lt;P&gt;you have new json which is log_message inside json event. you want to extract fields of log_message automatically.&lt;/P&gt;&lt;P&gt;I have taken sample event as below : cars is json inside json event&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;{
  "name":"John",
  "age":30,
  "cars":
    { "carname":"Ford", "models":"Fiesta" }
 }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;first, I have extracted to cars value "{ "carname":"Ford", "models":"Fiesta" }" to cars&amp;nbsp; using props.conf below. [jsontest] is my sourcetype of event.&lt;/P&gt;&lt;P&gt;created a report extractcars to be used in transforms.conf&lt;/P&gt;&lt;P&gt;props.conf&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[jsontest]
EXTRACT-cars = \"cars\":\s+\{\s(?&amp;lt;cars&amp;gt;[^\}]+)
REPORT-extractcars = extractcars&lt;/LI-CODE&gt;&lt;P&gt;and then I have extracted fields carname and models using transforms.conf&lt;/P&gt;&lt;P&gt;SOURCE_KEY is key to define for which field you would to apply REGEX&lt;/P&gt;&lt;P&gt;transforms.conf&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;[extractcars]
REGEX = \"(?&amp;lt;_KEY_1&amp;gt;[^\"]+)\"\:\"(?&amp;lt;_VAL_1&amp;gt;[^\"]+)
SOURCE_KEY = cars&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 14:08:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519446#M87833</guid>
      <dc:creator>thambisetty</dc:creator>
      <dc:date>2020-09-14T14:08:24Z</dc:date>
    </item>
    <item>
      <title>Re: EVAL with REX with SPATH (props / transforms)</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519469#M87835</link>
      <description>&lt;P&gt;I will give a shot but I have to do the replace first before the rex.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 14 Sep 2020 15:05:57 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/EVAL-with-REX-with-SPATH-props-transforms/m-p/519469#M87835</guid>
      <dc:creator>willadams</dc:creator>
      <dc:date>2020-09-14T15:05:57Z</dc:date>
    </item>
  </channel>
</rss>

