<?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 extract the list elements and group them into a table in Getting Data In</title>
    <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-the-list-elements-and-group-them-into-a-table/m-p/525295#M88704</link>
    <description>&lt;P&gt;Seems like you are almost there - the search can be added to first part, since that is already a search; not sure why you are overwriting _raw; you can use spath to extract the fields from json; and, you can use mvzip within mvzip (the delimiter defaults to "," anyway):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=duck source=/var/log/containers/**.log "e2eresult"
| spath
| eval all_fields=mvzip('e2eresult.features{}.failedScenarios',mvzip('e2eresult.features{}.name','e2eresult.features{}.passedScenarios'))
| mvexpand all_fields
| makemv delim="," all_fields
| eval failedTestCases=mvindex(all_fields, 0)
| eval nameOfTheTestScenario=mvindex(all_fields, 1) 
| eval passedTestCases=mvindex(all_fields, 2)
| table failedTestCases, nameOfTheTestScenario, passedTestCases&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Oct 2020 07:05:56 GMT</pubDate>
    <dc:creator>ITWhisperer</dc:creator>
    <dc:date>2020-10-19T07:05:56Z</dc:date>
    <item>
      <title>How to extract the list elements and group them into a table</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-the-list-elements-and-group-them-into-a-table/m-p/525288#M88700</link>
      <description>&lt;P&gt;Hi I was been trying hard to extract the following data into a table with the column names failedTestCases(&lt;STRONG&gt;failedScenarios&lt;/STRONG&gt;), nameOfTheTestScenario(&lt;STRONG&gt;name&lt;/STRONG&gt;), passedTestCases(&lt;STRONG&gt;passedScenarios&lt;/STRONG&gt;). And wanted to have a column with successPercent and FailurePercent&amp;nbsp;for each of the test scenario.&lt;/P&gt;&lt;P&gt;Example Data:&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;e2eresult: {&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;features: [&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;failedScenarios: 0&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;name: TPAS Activation scenario with Port In[mocked]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;passedScenarios: 2&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;failedScenarios: 0&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;name: TPAS Activation scenario[mocked]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;passedScenarios: 4&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;failedScenarios: 0&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;name: TPAS Add A Line scenario[mocked]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;passedScenarios: 6&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{}, &lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;{}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;]&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;project: test - automation&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;status: Passed&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;}&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;Here is what I have done something,&amp;nbsp;&lt;/P&gt;&lt;P&gt;index=duck source=/var/log/containers/**.log | search "e2eresult" | eval _raw="{\"e2eresult\": [{\"features\":[{\"failedScenarios\":\"0\",\"name\":\"TPAS Activation scenario with Port In [mocked]\",\"passedScenarios\":2},{\"failedScenarios\":\"0\",\"name\":\"TPAS Activation scenario [mocked]\",\"passedScenarios\":4}]}]}" | eval all_fields=mvzip('e2eresult.features{}.failedScenarios', 'e2eresult.features{}.name', 'e2eresult.features{}.passedScenarios', ",") | fields all_fields | mvexpand all_fields&lt;BR /&gt;| makemv delim="," all_fields&lt;BR /&gt;| eval failedTestCases=mvindex(all_fields, 0)&lt;BR /&gt;| eval nameOfTheTestScenario=mvindex(all_fields, 1) | eval passedTestCases=mvindex(all_fields, 2)&lt;BR /&gt;| table failedTestCases, nameOfTheTestScenario, passedTestCases&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 05:51:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-the-list-elements-and-group-them-into-a-table/m-p/525288#M88700</guid>
      <dc:creator>akarunkumar321</dc:creator>
      <dc:date>2020-10-19T05:51:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to extract the list elements and group them into a table</title>
      <link>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-the-list-elements-and-group-them-into-a-table/m-p/525295#M88704</link>
      <description>&lt;P&gt;Seems like you are almost there - the search can be added to first part, since that is already a search; not sure why you are overwriting _raw; you can use spath to extract the fields from json; and, you can use mvzip within mvzip (the delimiter defaults to "," anyway):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=duck source=/var/log/containers/**.log "e2eresult"
| spath
| eval all_fields=mvzip('e2eresult.features{}.failedScenarios',mvzip('e2eresult.features{}.name','e2eresult.features{}.passedScenarios'))
| mvexpand all_fields
| makemv delim="," all_fields
| eval failedTestCases=mvindex(all_fields, 0)
| eval nameOfTheTestScenario=mvindex(all_fields, 1) 
| eval passedTestCases=mvindex(all_fields, 2)
| table failedTestCases, nameOfTheTestScenario, passedTestCases&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Oct 2020 07:05:56 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Getting-Data-In/How-to-extract-the-list-elements-and-group-them-into-a-table/m-p/525295#M88704</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2020-10-19T07:05:56Z</dc:date>
    </item>
  </channel>
</rss>

