<?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 Need help with json spath search in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-json-spath-search/m-p/673747#M230672</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have seen a few of the spath topics around, but wasn't able to understand enough to make it work for my data.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would like to create a line chart using&amp;nbsp;&lt;EM&gt;pointlist&lt;/EM&gt;&amp;nbsp;values - it contains timestamp in epoch and CPU%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Search I tried but not working as expected to extract this data:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="splunk_test" source="test.json"   
| spath output=pointlist path=series{}.pointlist{}{}
| mvexpand pointlist
| table pointlist&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="madhav_dholakia_0-1704878418188.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28834i9CA51C7844841BD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="madhav_dholakia_0-1704878418188.png" alt="madhav_dholakia_0-1704878418188.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please see below sample json.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"status": "ok", "res_type": "time_series", "resp_version": 1, "query": "system.cpu.idle{*}", "from_date": 1698796800000, "to_date": 1701388799000, "series": [{"unit": [{"family": "percentage", "id": 17, "name": "percent", "short_name": "%", "plural": "percent", "scale_factor": 1.0}, null], "query_index": 0, "aggr": null, "metric": "system.cpu.idle", "tag_set": [], "expression": "system.cpu.idle{*}", "scope": "*", "interval": 14400, "length": 180, "start": 1698796800000, "end": 1701388799000, "pointlist": [[1698796800000.0, 67.48220718526889], [1698811200000.0, 67.15981521730248], [1698825600000.0, 67.07217666403122], [1698840000000.0, 64.72434584884627], [1698854400000.0, 64.0411289094932], [1698868800000.0, 64.17585938553243], [1698883200000.0, 64.044969119166], [1698897600000.0, 63.448143595246194], [1698912000000.0, 63.80226399404451], [1698926400000.0, 63.93216493520908], [1698940800000.0, 63.983679174088145], [1701331200000.0, 63.3783379315815], [1701345600000.0, 63.45321248782884], [1701360000000.0, 63.452383398041064], [1701374400000.0, 63.46314971048991]], "display_name": "system.cpu.idle", "attributes": {}}], "values": [], "times": [], "message": "", "group_by": []}&lt;/LI-CODE&gt;&lt;P&gt;can you please help how I can achieve this?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Madhav&lt;/P&gt;</description>
    <pubDate>Wed, 10 Jan 2024 09:23:08 GMT</pubDate>
    <dc:creator>madhav_dholakia</dc:creator>
    <dc:date>2024-01-10T09:23:08Z</dc:date>
    <item>
      <title>Need help with json spath search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-json-spath-search/m-p/673747#M230672</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I have seen a few of the spath topics around, but wasn't able to understand enough to make it work for my data.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;I would like to create a line chart using&amp;nbsp;&lt;EM&gt;pointlist&lt;/EM&gt;&amp;nbsp;values - it contains timestamp in epoch and CPU%&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Search I tried but not working as expected to extract this data:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="splunk_test" source="test.json"   
| spath output=pointlist path=series{}.pointlist{}{}
| mvexpand pointlist
| table pointlist&lt;/LI-CODE&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="madhav_dholakia_0-1704878418188.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/28834i9CA51C7844841BD6/image-size/medium?v=v2&amp;amp;px=400" role="button" title="madhav_dholakia_0-1704878418188.png" alt="madhav_dholakia_0-1704878418188.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Please see below sample json.&lt;/P&gt;&lt;LI-CODE lang="javascript"&gt;{"status": "ok", "res_type": "time_series", "resp_version": 1, "query": "system.cpu.idle{*}", "from_date": 1698796800000, "to_date": 1701388799000, "series": [{"unit": [{"family": "percentage", "id": 17, "name": "percent", "short_name": "%", "plural": "percent", "scale_factor": 1.0}, null], "query_index": 0, "aggr": null, "metric": "system.cpu.idle", "tag_set": [], "expression": "system.cpu.idle{*}", "scope": "*", "interval": 14400, "length": 180, "start": 1698796800000, "end": 1701388799000, "pointlist": [[1698796800000.0, 67.48220718526889], [1698811200000.0, 67.15981521730248], [1698825600000.0, 67.07217666403122], [1698840000000.0, 64.72434584884627], [1698854400000.0, 64.0411289094932], [1698868800000.0, 64.17585938553243], [1698883200000.0, 64.044969119166], [1698897600000.0, 63.448143595246194], [1698912000000.0, 63.80226399404451], [1698926400000.0, 63.93216493520908], [1698940800000.0, 63.983679174088145], [1701331200000.0, 63.3783379315815], [1701345600000.0, 63.45321248782884], [1701360000000.0, 63.452383398041064], [1701374400000.0, 63.46314971048991]], "display_name": "system.cpu.idle", "attributes": {}}], "values": [], "times": [], "message": "", "group_by": []}&lt;/LI-CODE&gt;&lt;P&gt;can you please help how I can achieve this?&lt;/P&gt;&lt;P&gt;Thank you.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Madhav&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 09:23:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-json-spath-search/m-p/673747#M230672</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2024-01-10T09:23:08Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with json spath search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-json-spath-search/m-p/673757#M230677</link>
      <description>&lt;P&gt;It appears that two dimensional arrays are not easily handled (unless someone else knows differently), so you could try something like this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath output=pointlist path=series{}.pointlist{}{}
| mvexpand pointlist
| table pointlist
| streamstats count as row
| streamstats count(eval(row % 2==1)) as row
| stats list(pointlist) as pointlist by row
| sort 0 row
| eval pointX = mvindex(pointlist,0)
| eval pointY = mvindex(pointlist,1)&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 10 Jan 2024 10:10:22 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-json-spath-search/m-p/673757#M230677</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2024-01-10T10:10:22Z</dc:date>
    </item>
    <item>
      <title>Re: Need help with json spath search</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Need-help-with-json-spath-search/m-p/673768#M230679</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;- thanks a lot, this worked like a charm.&lt;/P&gt;</description>
      <pubDate>Wed, 10 Jan 2024 11:17:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Need-help-with-json-spath-search/m-p/673768#M230679</guid>
      <dc:creator>madhav_dholakia</dc:creator>
      <dc:date>2024-01-10T11:17:20Z</dc:date>
    </item>
  </channel>
</rss>

