<?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 field extraction in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493513#M141334</link>
    <description>&lt;P&gt;Hi .. Its not working . &lt;/P&gt;</description>
    <pubDate>Tue, 10 Mar 2020 07:42:06 GMT</pubDate>
    <dc:creator>Nadhiya_Dubai</dc:creator>
    <dc:date>2020-03-10T07:42:06Z</dc:date>
    <item>
      <title>json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493511#M141332</link>
      <description>&lt;P&gt;Hi ,&lt;/P&gt;
&lt;P&gt;Below is the json snippet&lt;/P&gt;
&lt;P&gt;properties: { [-]&lt;BR /&gt;columns: [ [-]&lt;BR /&gt;{ [-]&lt;BR /&gt;name: PreTaxCost&lt;BR /&gt;type: Number&lt;BR /&gt;}&lt;BR /&gt;{ [-]&lt;BR /&gt;name: UsageDate&lt;BR /&gt;type: Number&lt;BR /&gt;}&lt;BR /&gt;{ [-]&lt;BR /&gt;name: Currency&lt;BR /&gt;type: String&lt;BR /&gt;}&lt;BR /&gt;]&lt;BR /&gt;nextLink: null&lt;BR /&gt;rows: [ [-]&lt;BR /&gt;[ [-]&lt;BR /&gt;37.399436789282746&lt;BR /&gt;20200301&lt;BR /&gt;USD&lt;BR /&gt;]&lt;BR /&gt;[ [-]&lt;BR /&gt;37.4605201027181&lt;BR /&gt;20200302&lt;BR /&gt;USD&lt;BR /&gt;]&lt;/P&gt;
&lt;P&gt;how can i extract the fields pretaxcost ,usagedate&lt;/P&gt;</description>
      <pubDate>Mon, 22 Jun 2020 22:39:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493511#M141332</guid>
      <dc:creator>Nadhiya_Dubai</dc:creator>
      <dc:date>2020-06-22T22:39:38Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493512#M141333</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;| makeresults 
| eval _raw="properties: { 
columns: 
{ 
name: PreTaxCost
type: Number
}
{ 
name: UsageDate
type: Number
}
{ 
name: Currency
type: String
}
]
nextLink: null
rows: 
[
37.399436789282746
20200301
USD
]
[
37.4605201027181
20200302
USD
]"
| rex max_match=0 "(?ms)(?&amp;lt;pretaxcost&amp;gt;[\d\.]+)\s*(?&amp;lt;usagedate&amp;gt;\d+)"
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Mar 2020 07:26:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493512#M141333</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-10T07:26:28Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493513#M141334</link>
      <description>&lt;P&gt;Hi .. Its not working . &lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 07:42:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493513#M141334</guid>
      <dc:creator>Nadhiya_Dubai</dc:creator>
      <dc:date>2020-03-10T07:42:06Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493514#M141335</link>
      <description>&lt;P&gt;what's your query?&lt;BR /&gt;
so, your json log is not valied json.&lt;BR /&gt;
what' s this log?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 07:43:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493514#M141335</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-10T07:43:45Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493515#M141336</link>
      <description>&lt;P&gt;When i give the above mentioned query provide by you with raw data ,it is working . &lt;BR /&gt;
For my below json data &lt;/P&gt;

&lt;P&gt;{ [-]&lt;BR /&gt;
   eTag: null&lt;BR /&gt;
   id: subscriptions/2808ca16-1c43-4d1c-8088-223b7c378d46/providers/Microsoft.CostManagement/query/b0b36773-618e-4490-9c11-57eaf5cb0f49&lt;BR /&gt;
   location: null&lt;BR /&gt;
   name: b0b36773-618e-4490-9c11-57eaf5cb0f49&lt;BR /&gt;
   properties: { [-]&lt;BR /&gt;
     columns: [ [-]&lt;BR /&gt;
       { [-]&lt;BR /&gt;
         name: PreTaxCost&lt;BR /&gt;
         type: Number&lt;BR /&gt;
       }&lt;BR /&gt;
       { [-]&lt;BR /&gt;
         name: UsageDate&lt;BR /&gt;
         type: Number&lt;BR /&gt;
       }&lt;BR /&gt;
       { [-]&lt;BR /&gt;
         name: Currency&lt;BR /&gt;
         type: String&lt;BR /&gt;
       }&lt;BR /&gt;
     ]&lt;BR /&gt;
     nextLink: null&lt;BR /&gt;
     rows: [ [-]&lt;BR /&gt;
       [ [-]&lt;BR /&gt;
         37.39104138816985&lt;BR /&gt;
         20200301&lt;BR /&gt;
         USD&lt;BR /&gt;
       ]&lt;BR /&gt;
       [ [-]&lt;BR /&gt;
         37.45212432304218&lt;BR /&gt;
         20200302&lt;BR /&gt;
         USD&lt;BR /&gt;
       ]&lt;/P&gt;

&lt;P&gt;index=azure_new  i | rex max_match=0 "(?ms)(?[\d.]+)\s*(?\d+)"  | table  pretaxcost,usagedate &lt;/P&gt;

&lt;P&gt;It is not working . What is the issue &lt;/P&gt;</description>
      <pubDate>Wed, 30 Sep 2020 04:35:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493515#M141336</guid>
      <dc:creator>Nadhiya_Dubai</dc:creator>
      <dc:date>2020-09-30T04:35:55Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493516#M141337</link>
      <description>&lt;P&gt;will you provide &lt;CODE&gt;_raw&lt;/CODE&gt; data?&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 08:25:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493516#M141337</guid>
      <dc:creator>to4kawa</dc:creator>
      <dc:date>2020-03-10T08:25:07Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493517#M141338</link>
      <description>&lt;P&gt;{"sku": null, "name": "b0b36773-618e-4490-9c11-57eaf5cb0f49", "properties": {"rows": [[37.39104138816985, 20200301, "USD"], [37.45212432304218, 20200302, "USD"], [37.19654530403741, 20200303, "USD"], [37.34428721156659, 20200304, "USD"], [38.220217017864336, 20200305, "USD"], [37.70977490679157, 20200306, "USD"], [37.53643148801985, 20200307, "USD"], [37.47332013352408, 20200308, "USD"], [27.71226225182299, 20200309, "USD"]], "columns": [{"type": "Number", "name": "PreTaxCost"}, {"type": "Number", "name": "UsageDate"}, {"type": "String", "name": "Currency"}], "nextLink": null}, "eTag": null, "location": null, "type": "Microsoft.CostManagement/query", "id": "subscriptions/2808ca16-1c43-4d1c-8088-223b7c378d46/providers/Microsoft.CostManagement/query/b0b36773-618e-4490-9c11-57eaf5cb0f49"}&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 08:40:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493517#M141338</guid>
      <dc:creator>Nadhiya_Dubai</dc:creator>
      <dc:date>2020-03-10T08:40:55Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493518#M141339</link>
      <description>&lt;P&gt;Hi, have you tried using spath?&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.0.2/SearchReference/Spath"&gt;https://docs.splunk.com/Documentation/Splunk/8.0.2/SearchReference/Spath&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 10 Mar 2020 12:08:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493518#M141339</guid>
      <dc:creator>nwenzl_splunk</dc:creator>
      <dc:date>2020-03-10T12:08:53Z</dc:date>
    </item>
    <item>
      <title>Re: json field extraction</title>
      <link>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493519#M141340</link>
      <description>&lt;P&gt;Hi @Nadhiya_Dubai,&lt;/P&gt;

&lt;P&gt;Try this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| spath path=properties.rows{}{} output=values | nomv values | eval values=split(values, "USD") | mvexpand values | rex field=values "^\s*(?&amp;lt;PreTaxCost&amp;gt;[\d\.]+)\s*(?&amp;lt;UsageDate&amp;gt;[\d]+)$" | where isnotnull(PreTaxCost) and isnotnull(UsageDate) | spath | table id, name, eTag, name, type, PreTaxCost, UsageDate, property.nextLink
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Sample query:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval _raw="{\"sku\": null, \"name\": \"b0b36773-618e-4490-9c11-57eaf5cb0f49\", \"properties\": {\"rows\": [[37.39104138816985, 20200301, \"USD\"], [37.45212432304218, 20200302, \"USD\"], [37.19654530403741, 20200303, \"USD\"], [37.34428721156659, 20200304, \"USD\"], [38.220217017864336, 20200305, \"USD\"], [37.70977490679157, 20200306, \"USD\"], [37.53643148801985, 20200307, \"USD\"], [37.47332013352408, 20200308, \"USD\"], [27.71226225182299, 20200309, \"USD\"]], \"columns\": [{\"type\": \"Number\", \"name\": \"PreTaxCost\"}, {\"type\": \"Number\", \"name\": \"UsageDate\"}, {\"type\": \"String\", \"name\": \"Currency\"}], \"nextLink\": null}, \"eTag\": null, \"location\": null, \"type\": \"Microsoft.CostManagement/query\", \"id\": \"subscriptions/2808ca16-1c43-4d1c-8088-223b7c378d46/providers/Microsoft.CostManagement/query/b0b36773-618e-4490-9c11-57eaf5cb0f49\"}" | spath path=properties.rows{}{} output=values | nomv values | eval values=split(values, "USD") | mvexpand values | rex field=values "^\s*(?&amp;lt;PreTaxCost&amp;gt;[\d\.]+)\s*(?&amp;lt;UsageDate&amp;gt;[\d]+)$" | where isnotnull(PreTaxCost) and isnotnull(UsageDate) | spath | table id, name, eTag, name, type, PreTaxCost, UsageDate, property.nextLink
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 10 Mar 2020 17:30:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/json-field-extraction/m-p/493519#M141340</guid>
      <dc:creator>manjunathmeti</dc:creator>
      <dc:date>2020-03-10T17:30:16Z</dc:date>
    </item>
  </channel>
</rss>

