<?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: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273813#M82597</link>
    <description>&lt;P&gt;Can you provide sample raw events, to see how the actual data looks? Mask any sensitive data while posting.&lt;/P&gt;</description>
    <pubDate>Fri, 27 May 2016 14:56:45 GMT</pubDate>
    <dc:creator>somesoni2</dc:creator>
    <dc:date>2016-05-27T14:56:45Z</dc:date>
    <item>
      <title>Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273806#M82590</link>
      <description>&lt;P&gt;I am using mvexpand for getting multiple fields from an XML and grouping them. Here is my search: &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;spath output=Manager path=env:Envelope.env:Body.dp:response.dp:status.Manager | spath output=Received path=env:Envelope.env:Body.dp:response.dp:status.Messages | spath output=Sent path=env:Envelope.env:Body.dp:response.dp:status.MQQMstatus.Sent |  fields Manager,Received,Sent |  eval a=mvzip(Manager,Sent,":") | mvexpand a|eval a=split(a,":")|eval Manager=mvindex(a,0) | eval Sent=mvindex(a,1) | eval z=mvzip(Manager,Received,":") | mvexpand z|eval z=split(z,":")|eval Manager=mvindex(z,0) | eval Received=mvindex(z,1) |stats max(Sent) as "Sent ", max(Received) as "Received" by Manager
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;When I run this search, it gives me values. However, the value for &lt;STRONG&gt;Sent&lt;/STRONG&gt; is right, but &lt;STRONG&gt;Received&lt;/STRONG&gt; is wrong. When I reverse the order of the eval and stats, the value in received is right and value of sent is wrong.  &lt;/P&gt;

&lt;P&gt;Am I using the mvexpand wrong? How do I make this search work? &lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 18:34:28 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273806#M82590</guid>
      <dc:creator>sushmitha_mj</dc:creator>
      <dc:date>2016-05-26T18:34:28Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273807#M82591</link>
      <description>&lt;P&gt;Please share some sample data.&lt;/P&gt;</description>
      <pubDate>Thu, 26 May 2016 19:39:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273807#M82591</guid>
      <dc:creator>richgalloway</dc:creator>
      <dc:date>2016-05-26T19:39:55Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273808#M82592</link>
      <description>&lt;P&gt;In my Case we have 5 fields. Sample data as follows: &lt;BR /&gt;
Values are the values in the field, count is the number of rows/entries of data. &lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Field: &lt;STRONG&gt;a&lt;/STRONG&gt; &lt;BR /&gt;
Values  Count&lt;BR /&gt;&lt;BR /&gt;
0   ------       96 &lt;BR /&gt;
250    ------     96&lt;BR /&gt;&lt;BR /&gt;
Mgr_CA ------   96&lt;BR /&gt;
Mgr_DO ------ 96 &lt;/P&gt;&lt;/LI&gt;
&lt;LI&gt;&lt;P&gt;Field: &lt;STRONG&gt;Manager&lt;/STRONG&gt;&lt;/P&gt;&lt;/LI&gt;
&lt;/OL&gt;

&lt;P&gt;Values  Count&lt;BR /&gt;&lt;BR /&gt;
Mgr_CA  ------  192&lt;BR /&gt;&lt;BR /&gt;
Mgr_DO   ------  192&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;&lt;P&gt;Field: &lt;STRONG&gt;Recieved&lt;/STRONG&gt;&lt;BR /&gt;
Values Count&lt;BR /&gt;&lt;BR /&gt;
0      ------       96&lt;BR /&gt;&lt;BR /&gt;
251       ------    96&lt;/P&gt;

&lt;OL&gt;
&lt;LI&gt;Field: &lt;STRONG&gt;Sent&lt;/STRONG&gt;
Values  Count&lt;BR /&gt;
0        ------    192&lt;BR /&gt;
251  ------ 192&lt;/LI&gt;
&lt;LI&gt;Field : &lt;STRONG&gt;z&lt;/STRONG&gt;
Values  Count&lt;BR /&gt;
0       ------      96&lt;BR /&gt;
251      ------    96&lt;BR /&gt;
Mgr_CA  ------  96&lt;BR /&gt;
Mgr_DO  ------  96&lt;/LI&gt;
&lt;/OL&gt;&lt;/LI&gt;
&lt;/OL&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:49:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273808#M82592</guid>
      <dc:creator>sushmitha_mj</dc:creator>
      <dc:date>2020-09-29T09:49:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273809#M82593</link>
      <description>&lt;P&gt;Try this&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;spath output=Manager path=env:Envelope.env:Body.dp:response.dp:status.Manager | spath output=Received path=env:Envelope.env:Body.dp:response.dp:status.Messages | spath output=Sent path=env:Envelope.env:Body.dp:response.dp:status.MQQMstatus.Sent |  fields Manager,Received,Sent |  eval a=mvzip(Manager,mvzip(Sent, Received, ":"), ":") | mvexpand a|eval a=split(a,":")|eval Manager=mvindex(a,0) | eval Sent=mvindex(a,1) | eval Received=mvindex(z,2) |stats max(Sent) as "Sent ", max(Received) as "Received" by Manager
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 May 2016 20:40:02 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273809#M82593</guid>
      <dc:creator>sundareshr</dc:creator>
      <dc:date>2016-05-26T20:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273810#M82594</link>
      <description>&lt;P&gt;Not sure you need the mvexpand at all. Just give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;spath output=Manager path=env:Envelope.env:Body.dp:response.dp:status.Manager | spath output=Received path=env:Envelope.env:Body.dp:response.dp:status.Messages | spath output=Sent path=env:Envelope.env:Body.dp:response.dp:status.MQQMstatus.Sent |stats max(Sent) as "Sent ", max(Received) as "Received" by Manager
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 26 May 2016 21:13:07 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273810#M82594</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-26T21:13:07Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273811#M82595</link>
      <description>&lt;P&gt;Thanks. &lt;BR /&gt;
I understand the logic you are trying to use, but I am getting an error&lt;BR /&gt;
 "Error in 'eval' command: The expression is malformed. Expected )." on this line &lt;BR /&gt;
mvzip(Manager,mvzip(Sent, Received, ":"), ":") &lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 14:49:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273811#M82595</guid>
      <dc:creator>sushmitha_mj</dc:creator>
      <dc:date>2016-05-27T14:49:43Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273812#M82596</link>
      <description>&lt;P&gt;Thanks...&lt;BR /&gt;
This query works but the output it is giving is wrong. &lt;BR /&gt;
It is showing 250 for both  managers and for both sent and received. It should have been zero for one manager and 250 for the other manager. It is probably getting the max on both, not grouping properly &lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 14:52:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273812#M82596</guid>
      <dc:creator>sushmitha_mj</dc:creator>
      <dc:date>2016-05-27T14:52:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273813#M82597</link>
      <description>&lt;P&gt;Can you provide sample raw events, to see how the actual data looks? Mask any sensitive data while posting.&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 14:56:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273813#M82597</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-27T14:56:45Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273814#M82598</link>
      <description>&lt;P&gt;In my Case we have 5 fields. Sample data as follows: (Based on my initial query using 2 mvzip "a" and "z" ) &lt;BR /&gt;
Values are the values in the field, count is the number of rows/entries of data.&lt;/P&gt;

&lt;P&gt;Field: a &lt;BR /&gt;
Values Count &lt;BR /&gt;
0 ------ 96 &lt;BR /&gt;
251 ------ 96 &lt;BR /&gt;
Mgr_CA ------ 96&lt;BR /&gt;
Mgr_DO ------ 96&lt;/P&gt;

&lt;P&gt;Field: Manager&lt;/P&gt;

&lt;P&gt;Values Count &lt;BR /&gt;
Mgr_CA ------ 192 &lt;BR /&gt;
Mgr_DO ------ 192&lt;/P&gt;

&lt;P&gt;Field: Recieved&lt;BR /&gt;
Values Count &lt;BR /&gt;
0 ------ 96 &lt;BR /&gt;
251 ------ 96&lt;/P&gt;

&lt;P&gt;Field: Sent&lt;BR /&gt;
Values Count &lt;BR /&gt;
0 ------ 192 &lt;BR /&gt;
251 ------ 192&lt;/P&gt;

&lt;P&gt;Field : z&lt;BR /&gt;
Values Count &lt;BR /&gt;
0 ------ 96 &lt;BR /&gt;
251 ------ 96 &lt;BR /&gt;
Mgr_CA ------ 96 &lt;BR /&gt;
Mgr_DO ------ 96&lt;/P&gt;

&lt;P&gt;The output I get for your query without using mv command is &lt;BR /&gt;
Manager ---------      Sent  ---------      Received &lt;BR /&gt;
Mgr_CA    ---------       251  ---------       251&lt;BR /&gt;
Mgr_DO    ---------     251   ---------      251&lt;/P&gt;

&lt;P&gt;What it actually should be : &lt;/P&gt;

&lt;P&gt;Manager  ---------      Sent  ---------      Received &lt;BR /&gt;
Mgr_CA      ---------     0     ---------    0&lt;BR /&gt;
Mgr_DO  ---------       251  ---------       251&lt;/P&gt;</description>
      <pubDate>Tue, 29 Sep 2020 09:49:29 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273814#M82598</guid>
      <dc:creator>sushmitha_mj</dc:creator>
      <dc:date>2020-09-29T09:49:29Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273815#M82599</link>
      <description>&lt;P&gt;Would be better if you just provide a sample raw data from below query. How many (OR whether) mv operations are required will depend on that.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;spath output=Manager path=env:Envelope.env:Body.dp:response.dp:status.Manager
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 May 2016 18:11:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273815#M82599</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-27T18:11:05Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273816#M82600</link>
      <description>&lt;P&gt;This is the raw data. I have just put entered it manually. &lt;BR /&gt;
because I could attach screenshots&lt;/P&gt;</description>
      <pubDate>Fri, 27 May 2016 19:54:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273816#M82600</guid>
      <dc:creator>sushmitha_mj</dc:creator>
      <dc:date>2016-05-27T19:54:10Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273817#M82601</link>
      <description>&lt;P&gt;Give this a try&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;your base search | spath output=Manager path=env:Envelope.env:Body.dp:response.dp:status.Manager | spath output=Received path=env:Envelope.env:Body.dp:response.dp:status.Messages | spath output=Sent path=env:Envelope.env:Body.dp:response.dp:status.MQQMstatus.Sent |  fields Manager,Received,Sent | eval temp=mvzip(mvzip(Manager,Sent,"#"),Received,"#") | table temp  | mvexpand temp | rex field=temp "(?&amp;lt;Manager&amp;gt;.+)#(?&amp;lt;Sent&amp;gt;.+)#(?&amp;lt;Received&amp;gt;.+)"|
stats max(Sent) as "Sent ", max(Received) as "Received" by Manager
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Fri, 27 May 2016 20:03:37 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273817#M82601</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-05-27T20:03:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using mvexpand to get multiple fields from XML data, why am I getting incorrect values for a field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273818#M82602</link>
      <description>&lt;P&gt;Wow... It worked... &lt;BR /&gt;
Thank you so much.. &lt;/P&gt;</description>
      <pubDate>Mon, 30 May 2016 20:24:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Using-mvexpand-to-get-multiple-fields-from-XML-data-why-am-I/m-p/273818#M82602</guid>
      <dc:creator>sushmitha_mj</dc:creator>
      <dc:date>2016-05-30T20:24:54Z</dc:date>
    </item>
  </channel>
</rss>

