<?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 display all values within the same field name. in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295265#M89115</link>
    <description>&lt;P&gt;Hi ndayanat,&lt;BR /&gt;
using this regex you should have all name values (see &lt;A href="https://regex101.com/r/8BNM95/1):"&gt;https://regex101.com/r/8BNM95/1):&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;name\=\"(?&amp;lt;name&amp;gt;[^\"]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can use it in a rex command &lt;CODE&gt;| rex "name\=\"(?&amp;lt;name&amp;gt;[^\"]*)"&lt;/CODE&gt; or in a field extraction.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
    <pubDate>Tue, 28 Mar 2017 07:08:36 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2017-03-28T07:08:36Z</dc:date>
    <item>
      <title>how to display all values within the same field name.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295262#M89112</link>
      <description>&lt;PRE&gt;&lt;CODE&gt;     Ex log:
     (This is a XML log, giving details from the middle and not the entire log)

 Event 1: 
 &amp;lt;students&amp;gt;
 &amp;lt;student name="Raja" age="13" class="6" /&amp;gt;
 &amp;lt;student name="Nar" age="15" class'"8" /&amp;gt;
 &amp;lt;student name="Mag" age="16" class="7" /&amp;gt;
 &amp;lt;/students&amp;gt;

 Event 2:
 &amp;lt;students&amp;gt;
 &amp;lt;student name="Rex" age="13" class="6" /&amp;gt;
 &amp;lt;student name="Nanny" age="15" class'"8" /&amp;gt;
 &amp;lt;/students&amp;gt;
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;I need to know the values under the field "Name". As you can see the count varies for each event. When i check the values it just displays the first value of each of the event. &lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 21:23:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295262#M89112</guid>
      <dc:creator>ndayanat</dc:creator>
      <dc:date>2017-03-27T21:23:12Z</dc:date>
    </item>
    <item>
      <title>Re: how to display all values within the same field name.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295263#M89113</link>
      <description>&lt;P&gt;What is your regex that is extracting it currently?  &lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 21:28:21 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295263#M89113</guid>
      <dc:creator>briancronrath</dc:creator>
      <dc:date>2017-03-27T21:28:21Z</dc:date>
    </item>
    <item>
      <title>Re: how to display all values within the same field name.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295264#M89114</link>
      <description>&lt;P&gt;@ndayanat... Ideally you should be using either &lt;STRONG&gt;spath&lt;/STRONG&gt; or &lt;STRONG&gt;xpath&lt;/STRONG&gt; command to traverse XML data.&lt;/P&gt;

&lt;P&gt;Following should return all names&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| spath path=students.student{}{@name}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Following can be used to find specific position of name&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| spath path=students.student{1}{@name}
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Read spath documentation or details: &lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath#6:_Extract_a_subset_of_a_XML_attribute"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Spath#6:_Extract_a_subset_of_a_XML_attribute&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Since you are getting only first value seems like you are using rex command which by default returns only the first match. you can add &lt;CODE&gt;max_match=0&lt;/CODE&gt; to &lt;STRONG&gt;rex&lt;/STRONG&gt; command to return all matches for regular expression based name field extraction.&lt;BR /&gt;
&lt;A href="https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex#Optional_arguments"&gt;https://docs.splunk.com/Documentation/Splunk/latest/SearchReference/Rex#Optional_arguments&lt;/A&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Mar 2017 21:56:48 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295264#M89114</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-27T21:56:48Z</dc:date>
    </item>
    <item>
      <title>Re: how to display all values within the same field name.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295265#M89115</link>
      <description>&lt;P&gt;Hi ndayanat,&lt;BR /&gt;
using this regex you should have all name values (see &lt;A href="https://regex101.com/r/8BNM95/1):"&gt;https://regex101.com/r/8BNM95/1):&lt;/A&gt;&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;name\=\"(?&amp;lt;name&amp;gt;[^\"]*)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;You can use it in a rex command &lt;CODE&gt;| rex "name\=\"(?&amp;lt;name&amp;gt;[^\"]*)"&lt;/CODE&gt; or in a field extraction.&lt;/P&gt;

&lt;P&gt;Bye.&lt;BR /&gt;
Giuseppe&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 07:08:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295265#M89115</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2017-03-28T07:08:36Z</dc:date>
    </item>
    <item>
      <title>Re: how to display all values within the same field name.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295266#M89116</link>
      <description>&lt;P&gt;@niketnilay,&lt;/P&gt;

&lt;P&gt;Thanks for your time. I tried spath, but it doesnt seem to work. Used max_match=0 in rex and i worked fine. Not able to understand the difference.&lt;/P&gt;</description>
      <pubDate>Tue, 28 Mar 2017 23:21:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295266#M89116</guid>
      <dc:creator>ndayanat</dc:creator>
      <dc:date>2017-03-28T23:21:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to display all values within the same field name.</title>
      <link>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295267#M89117</link>
      <description>&lt;P&gt;@ndayanat... for spath or xpath one of the requirement would be that you have XML extracted in field.  Which you define as input to the command and based on the path provided output will show you the extracted field. So you can try printing the field provided as input and field selected as output to test whether XML is correct or not and that output field is showing value or not.&lt;/P&gt;</description>
      <pubDate>Wed, 29 Mar 2017 04:49:23 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/how-to-display-all-values-within-the-same-field-name/m-p/295267#M89117</guid>
      <dc:creator>niketn</dc:creator>
      <dc:date>2017-03-29T04:49:23Z</dc:date>
    </item>
  </channel>
</rss>

