<?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: How to convert string result into rows? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317431#M94954</link>
    <description>&lt;P&gt;Thanks both of the answers worked!.  Thank you very much&lt;/P&gt;</description>
    <pubDate>Fri, 02 Mar 2018 06:01:08 GMT</pubDate>
    <dc:creator>bora9</dc:creator>
    <dc:date>2018-03-02T06:01:08Z</dc:date>
    <item>
      <title>How to convert string result into rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317427#M94950</link>
      <description>&lt;P&gt;Hello I've been trying to chart/table the following search but I keep getting the wrong sorting for my array.&lt;/P&gt;

&lt;P&gt;My search :&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="rest://RGM Stats"
| head 1
| rename intervals{}.end_at as Final intervals{}.wh_del as "Energy Delivered" 
| table Final "Energy Delivered"
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;My raw:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;{
   "system_id":00092384,
   "total_devices":1,
   "intervals":[
      {
         "end_at":"2018-03-01T00:15:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T00:30:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T00:45:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T01:00:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T01:15:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T01:30:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T01:45:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T02:00:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T02:15:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T02:30:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T02:45:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T03:00:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T03:15:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T03:30:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T03:45:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T04:00:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T04:15:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T04:30:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T04:45:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T05:00:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T05:15:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T05:30:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T05:45:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T06:00:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T06:15:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T06:30:00-07:00",
         "devices_reporting":1,
         "wh_del":0
      },
      {
         "end_at":"2018-03-01T06:45:00-07:00",
         "devices_reporting":1,
         "wh_del":10
      },
      {
         "end_at":"2018-03-01T07:00:00-07:00",
         "devices_reporting":1,
         "wh_del":142
      },
      {
         "end_at":"2018-03-01T07:15:00-07:00",
         "devices_reporting":1,
         "wh_del":273
      },
      {
         "end_at":"2018-03-01T07:30:00-07:00",
         "devices_reporting":1,
         "wh_del":356
      },
      {
         "end_at":"2018-03-01T07:45:00-07:00",
         "devices_reporting":1,
         "wh_del":428
      },
      {
         "end_at":"2018-03-01T08:00:00-07:00",
         "devices_reporting":1,
         "wh_del":483
      },
      {
         "end_at":"2018-03-01T08:15:00-07:00",
         "devices_reporting":1,
         "wh_del":525
      },
      {
         "end_at":"2018-03-01T08:30:00-07:00",
         "devices_reporting":1,
         "wh_del":566
      },
      {
         "end_at":"2018-03-01T08:45:00-07:00",
         "devices_reporting":1,
         "wh_del":593
      },
      {
         "end_at":"2018-03-01T09:00:00-07:00",
         "devices_reporting":1,
         "wh_del":621
      }
   ],
   "meta":{
      "status":"normal",
      "last_report_at":"2018-03-01T09:03:29-07:00",
      "last_energy_at":"2018-03-01T09:02:51-07:00",
      "operational_at":"2017-09-14T16:39:46-06:00"
   }
}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This is providing me the correct answer and sorting but its giving me the answer as a string.&lt;/P&gt;

&lt;P&gt;Im trying to convert the answer into rows without loosing the order for both columns but have been unable to do it.&lt;/P&gt;

&lt;P&gt;Any help is appreciate it.  Thanks in advanced.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 02:56:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317427#M94950</guid>
      <dc:creator>bora9</dc:creator>
      <dc:date>2018-03-02T02:56:46Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert string result into rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317428#M94951</link>
      <description>&lt;P&gt;Hi @bora9,&lt;/P&gt;

&lt;P&gt;Can you please try this search?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;source="rest://RGM Stats" | head 1 | spath intervals{} output=intervals | rename intervals{}.end_at as end_at, intervals{}.wh_del as wh_del | eval temp=mvzip(end_at,wh_del)| stats count by _time temp | eval end_at=mvindex(split(temp,","),0),wh_del=mvindex(split(temp,","),1) | table end_at wh_del
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;another thing I have validated your provided JSON on &lt;A href="https://jsonlint.com/"&gt;https://jsonlint.com/&lt;/A&gt; which shows invalid near "system_id":00092384. Can you please check also that?&lt;/P&gt;

&lt;P&gt;&lt;STRONG&gt;My Sample work around:&lt;/STRONG&gt;&lt;BR /&gt;
first execute this search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults | eval _raw="{ \"system_id\":\"00092384\", \"total_devices\":1, \"intervals\":[ { \"end_at\":\"2018-03-01T00:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T00:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T00:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T01:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T01:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T01:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T01:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T02:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T02:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T02:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T02:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T03:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T03:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T03:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T03:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T04:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T04:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T04:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T04:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T05:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T05:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T05:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T05:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T06:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T06:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T06:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":0 }, { \"end_at\":\"2018-03-01T06:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":10 }, { \"end_at\":\"2018-03-01T07:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":142 }, { \"end_at\":\"2018-03-01T07:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":273 }, { \"end_at\":\"2018-03-01T07:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":356 }, { \"end_at\":\"2018-03-01T07:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":428 }, { \"end_at\":\"2018-03-01T08:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":483 }, { \"end_at\":\"2018-03-01T08:15:00-07:00\", \"devices_reporting\":1, \"wh_del\":525 }, { \"end_at\":\"2018-03-01T08:30:00-07:00\", \"devices_reporting\":1, \"wh_del\":566 }, { \"end_at\":\"2018-03-01T08:45:00-07:00\", \"devices_reporting\":1, \"wh_del\":593 }, { \"end_at\":\"2018-03-01T09:00:00-07:00\", \"devices_reporting\":1, \"wh_del\":621 } ], \"meta\":{ \"status\":\"normal\", \"last_report_at\":\"2018-03-01T09:03:29-07:00\", \"last_energy_at\":\"2018-03-01T09:02:51-07:00\", \"operational_at\":\"2017-09-14T16:39:46-06:00\" } }"
| collect index=main sourcetype=test
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;then execute below search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main sourcetype=test | head 1 | spath intervals{} output=intervals | rename intervals{}.end_at as end_at, intervals{}.wh_del as wh_del | eval temp=mvzip(end_at,wh_del)| stats count by _time temp | eval end_at=mvindex(split(temp,","),0),wh_del=mvindex(split(temp,","),1) | table end_at wh_del
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Thanks&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 05:08:01 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317428#M94951</guid>
      <dc:creator>kamlesh_vaghela</dc:creator>
      <dc:date>2018-03-02T05:08:01Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert string result into rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317429#M94952</link>
      <description>&lt;P&gt;@bora9, try the following run any where search. The makeresults and eval command before rex command are used to mock the data as per the question. The rex command is used to extract both fields you are interested in at the same time and then use mvexpand to generate multiple row:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| makeresults
| eval _raw="{
    \"system_id\":\"00092384\",
    \"total_devices\":1,
    \"intervals\":[
       {
          \"end_at\":\"2018-03-01T00:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T00:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T00:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T01:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T01:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T01:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T01:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T02:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T02:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T02:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T02:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T03:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T03:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T03:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T03:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T04:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T04:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T04:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T04:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T05:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T05:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T05:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T05:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T06:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T06:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T06:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":0
       },
       {
          \"end_at\":\"2018-03-01T06:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":10
       },
       {
          \"end_at\":\"2018-03-01T07:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":142
       },
       {
          \"end_at\":\"2018-03-01T07:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":273
       },
       {
          \"end_at\":\"2018-03-01T07:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":356
       },
       {
          \"end_at\":\"2018-03-01T07:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":428
       },
       {
          \"end_at\":\"2018-03-01T08:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":483
       },
       {
          \"end_at\":\"2018-03-01T08:15:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":525
       },
       {
          \"end_at\":\"2018-03-01T08:30:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":566
       },
       {
          \"end_at\":\"2018-03-01T08:45:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":593
       },
       {
          \"end_at\":\"2018-03-01T09:00:00-07:00\",
          \"devices_reporting\":1,
          \"wh_del\":621
       }
    ],
    \"meta\":{
       \"status\":\"normal\",
       \"last_report_at\":\"2018-03-01T09:03:29-07:00\",
       \"last_energy_at\":\"2018-03-01T09:02:51-07:00\",
       \"operational_at\":\"2017-09-14T16:39:46-06:00\"
    }
 }"
| rex "\"end_at\":\"(?&amp;lt;end_at&amp;gt;[^\"]+)\"\,\s+\"devices_reporting\":(?&amp;lt;devices_reporting&amp;gt;[^\,]+)\,\s+\"wh_del\":(?&amp;lt;wh_del&amp;gt;\d+)\s+\}" max_match=0
| fields - _time _raw
| eval data=mvzip(end_at,wh_del)
| fields data
| mvexpand data
| eval data=split(data,",")
| eval Final=mvindex(data,0)
| eval Energy_Delivered=mvindex(data,1)
| fields - data
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 02 Mar 2018 05:32:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317429#M94952</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2018-03-02T05:32:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert string result into rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317430#M94953</link>
      <description>&lt;P&gt;Thanks works like a charm.&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 06:00:33 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317430#M94953</guid>
      <dc:creator>bora9</dc:creator>
      <dc:date>2018-03-02T06:00:33Z</dc:date>
    </item>
    <item>
      <title>Re: How to convert string result into rows?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317431#M94954</link>
      <description>&lt;P&gt;Thanks both of the answers worked!.  Thank you very much&lt;/P&gt;</description>
      <pubDate>Fri, 02 Mar 2018 06:01:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-convert-string-result-into-rows/m-p/317431#M94954</guid>
      <dc:creator>bora9</dc:creator>
      <dc:date>2018-03-02T06:01:08Z</dc:date>
    </item>
  </channel>
</rss>

