<?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 read an array of fields from a single event and make into different records ? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560089#M159162</link>
    <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;Yes I did the command that you gave me. Do you mean to say that I have to do a&amp;nbsp; separate spath for each field that I need ?&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Mon, 19 Jul 2021 16:37:55 GMT</pubDate>
    <dc:creator>JP</dc:creator>
    <dc:date>2021-07-19T16:37:55Z</dc:date>
    <item>
      <title>How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/559850#M159081</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;In Splunk, I have Test Automation results logs which has details like Test case name, Test Status, Error, Duration, Date etc in multiple events. Each event has nearly 25 - 20 test cases details in an array. I need to fetch each test case as a single record.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JP_1-1626453900513.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15128i38D93745F931D958/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JP_1-1626453900513.png" alt="JP_1-1626453900513.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;When I use spath, it is fetching the fields, but all the test case of a single event is written as a single record.&lt;/P&gt;&lt;P&gt;index=jenkins OR source=\test OR job_name:"Dev/TestAutomation/Regression"| spath&lt;/P&gt;&lt;P&gt;I am very new to Splunk. Is there any way by which I can write each testcase details as a single record. With these details, my requirement is to create an Regression Test Automation dashboard.&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 16 Jul 2021 16:49:15 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/559850#M159081</guid>
      <dc:creator>JP</dc:creator>
      <dc:date>2021-07-16T16:49:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/559866#M159087</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235872"&gt;@JP&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;I hope I understood correctly what you are trying to do, if so maybe this will enable you to progress toward a solution (Working on the Win Events for demo sake) :&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=main sourcetype=XmlWinEventLog 
| fields _raw 
| spath 
| foreach Event.System.* 
    [ eval new_field=mvappend(new_field,'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')] 
| table new_field 
| mvexpand new_field&lt;/LI-CODE&gt;</description>
      <pubDate>Fri, 16 Jul 2021 19:20:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/559866#M159087</guid>
      <dc:creator>efika</dc:creator>
      <dc:date>2021-07-16T19:20:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560067#M159153</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/57922"&gt;@efika&lt;/a&gt;&amp;nbsp;The results are still remaining the same. One event has multiple values. Tried exactly the same.&amp;nbsp;&lt;/P&gt;&lt;P&gt;[ eval new_field=mvappend(new_field,'&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;')]&lt;/P&gt;&lt;P&gt;In the &amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;, I gave the multivalue field. I hope that is right?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:16:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560067#M159153</guid>
      <dc:creator>JP</dc:creator>
      <dc:date>2021-07-19T14:16:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560068#M159154</link>
      <description>&lt;P&gt;Try something like this (you may have to adjust because it is difficult to read images so I may have got the structure wrong):&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=testsuite.testcase{} output=testcase
| mvexpand testcase&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Jul 2021 14:31:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560068#M159154</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-19T14:31:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560081#M159159</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp; Even after running this query, when I view the search result in the Tabular view, I still see multiple testcasenames, status etc clubbed together in one event. Below is a screenshot of a single event which has the testcase and status together. For my requirement to create a dashboard, I would like to have each of these as a single event.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="JP_0-1626709426782.png" style="width: 400px;"&gt;&lt;img src="https://community.splunk.com/t5/image/serverpage/image-id/15153i46C9592FA2E37721/image-size/medium?v=v2&amp;amp;px=400" role="button" title="JP_0-1626709426782.png" alt="JP_0-1626709426782.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 15:45:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560081#M159159</guid>
      <dc:creator>JP</dc:creator>
      <dc:date>2021-07-19T15:45:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560087#M159161</link>
      <description>&lt;P&gt;Did you do this instead of your spath? Try this to also extract the elements from testcase:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| spath path=testsuite.testcase{} output=testcase
| mvexpand testcase
| spath input=testcase&lt;/LI-CODE&gt;</description>
      <pubDate>Mon, 19 Jul 2021 16:12:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560087#M159161</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-19T16:12:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560089#M159162</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt;&amp;nbsp;Yes I did the command that you gave me. Do you mean to say that I have to do a&amp;nbsp; separate spath for each field that I need ?&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 16:37:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560089#M159162</guid>
      <dc:creator>JP</dc:creator>
      <dc:date>2021-07-19T16:37:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560090#M159163</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/235872"&gt;@JP&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should keep the '&lt;SPAN&gt;&amp;lt;&amp;lt;FIELD&amp;gt;&amp;gt;', this is the variable for the foreach loop (see the docs&amp;nbsp;&lt;A href="https://docs.splunk.com/Documentation/Splunk/8.2.1/SearchReference/Foreach" target="_blank"&gt;https://docs.splunk.com/Documentation/Splunk/8.2.1/SearchReference/Foreach&lt;/A&gt;)&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 16:42:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560090#M159163</guid>
      <dc:creator>efika</dc:creator>
      <dc:date>2021-07-19T16:42:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560097#M159167</link>
      <description>&lt;P&gt;If you want separate event from an array, you need to extract the array to a multivalue field, then expand the multivalue field to separate events, then you can extract elements of the array.&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 17:01:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560097#M159167</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-19T17:01:43Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560130#M159176</link>
      <description>&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; - Thanks I understand and it worked to change the grouped events to single events. But the issue now is the events are very repetitive. I tried to use dedup command, but still there are N number of&amp;nbsp;&lt;SPAN&gt;duplicates and the records are not coming in the right mapping. The data is so jumbled up. Following is the command that I used.&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=jenkins* host=opsdev-app-jenkins.route53.com source="/test"
| search job_name=Dev/TestAutomation/Cert1_Regression
| spath path=testsuite.testcase{}.classname output=tclassname
| spath path=testsuite.testcase{}.testname output=testname
| spath path=testsuite.testcase{}.status output=status
| mvexpand tclassname
| mvexpand testname
| mvexpand status
| rename metadata.Nexis.Auto.Environment AS Environment
| table job_started_at job_duration job_name Environment tclassname testname status&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have been trying to find something that will help me to map data rightly and avoid duplicates, but I unable to find the solution. Is there anything I could do to avoid duplicates and jumbling up of data ?&lt;/P&gt;</description>
      <pubDate>Mon, 19 Jul 2021 21:57:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560130#M159176</guid>
      <dc:creator>JP</dc:creator>
      <dc:date>2021-07-19T21:57:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560163#M159188</link>
      <description>&lt;P&gt;No, as I showed, you need to extract the array as a multivalue field, mvexpand that, then extract the sub-elements of those&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index=jenkins* host=opsdev-app-jenkins.route53.com source="/test"
| search job_name=Dev/TestAutomation/Cert1_Regression
| spath path=testsuite.testcase{} output=testcase
| mvexpand testcase
| spath input=testcase path=classname output=tclassname
| spath input=testcase path=testname output=testname
| spath input=testcase path=status output=status
| rename metadata.Nexis.Auto.Environment AS Environment
| table job_started_at job_duration job_name Environment tclassname testname status&lt;/LI-CODE&gt;</description>
      <pubDate>Tue, 20 Jul 2021 06:28:31 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560163#M159188</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-07-20T06:28:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560221#M159209</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/225168"&gt;@ITWhisperer&lt;/a&gt; I understood the concept and it works perfectly. Thank you!&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 14:51:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560221#M159209</guid>
      <dc:creator>JP</dc:creator>
      <dc:date>2021-07-20T14:51:05Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560225#M159211</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/57922"&gt;@efika&lt;/a&gt;&amp;nbsp;for replying.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 15:18:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560225#M159211</guid>
      <dc:creator>JP</dc:creator>
      <dc:date>2021-07-20T15:18:37Z</dc:date>
    </item>
    <item>
      <title>Re: How to read an array of fields from a single event and make into different records ?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560234#M159213</link>
      <description>&lt;P&gt;My pleasure. I'm glad I could do something to help someone today.&lt;/P&gt;</description>
      <pubDate>Tue, 20 Jul 2021 17:14:13 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-read-an-array-of-fields-from-a-single-event-and-make-into/m-p/560234#M159213</guid>
      <dc:creator>efika</dc:creator>
      <dc:date>2021-07-20T17:14:13Z</dc:date>
    </item>
  </channel>
</rss>

