<?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: Why am I unable to group by an xmlkv field? in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230753#M68423</link>
    <description>&lt;P&gt;"&lt;EM&gt;Or possibly the field is a string, not a number so stats can't help it."&lt;/EM&gt;  &lt;/P&gt;

&lt;P&gt;It is a string, but I'm not sure what you mean by your comment that stats can't help it.&lt;/P&gt;</description>
    <pubDate>Tue, 16 Aug 2016 20:09:55 GMT</pubDate>
    <dc:creator>riotto</dc:creator>
    <dc:date>2016-08-16T20:09:55Z</dc:date>
    <item>
      <title>Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230749#M68419</link>
      <description>&lt;P&gt;I am trying to group events and get the delta  _time.  This search returns the events I want to group. &lt;BR /&gt;
The events are XML.  I cannot get the events to group by the &lt;STRONG&gt;clientid&lt;/STRONG&gt;.&lt;/P&gt;

&lt;P&gt;Here's what I have so far:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="personalizedoffer" earliest="08/16/2016:00:00:00" (XML_INPUT_LOGGER AND offerInquiryRequest) OR "EnVisionResponse version"   | xmlkv | stats range(_time) as duration by clientid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;The clientid is a field in the XML body of the raw data. I used the &lt;CODE&gt;xmlkv&lt;/CODE&gt; command to break up the XML into fields where I want to group by the clientid field. Is this the right way to approach this?&lt;/P&gt;

&lt;P&gt;Thanks in Advance&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 19:24:34 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230749#M68419</guid>
      <dc:creator>riotto</dc:creator>
      <dc:date>2016-08-16T19:24:34Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230750#M68420</link>
      <description>&lt;P&gt;It depends. How does your raw data looks like? Is it a pure xml OR you've some additional text?&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 19:52:24 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230750#M68420</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-16T19:52:24Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230751#M68421</link>
      <description>&lt;P&gt;it's pure xml&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 19:57:43 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230751#M68421</guid>
      <dc:creator>riotto</dc:creator>
      <dc:date>2016-08-16T19:57:43Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230752#M68422</link>
      <description>&lt;P&gt;I just tried the very same thing with one of my xmlkv searches with the same syntax as you show an it worked.  &lt;/P&gt;

&lt;P&gt;Maybe rename the field and see if that gives it some magic?&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|rename clientid AS ClientID | stats range(_time) as duration by ClientId
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Or possibly the field is a string, not a number so stats can't help it.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;|eval ClientID=tonumber(clientid,10) |stats range(_time) as duration by ClientID
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 16 Aug 2016 20:04:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230752#M68422</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2016-08-16T20:04:53Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230753#M68423</link>
      <description>&lt;P&gt;"&lt;EM&gt;Or possibly the field is a string, not a number so stats can't help it."&lt;/EM&gt;  &lt;/P&gt;

&lt;P&gt;It is a string, but I'm not sure what you mean by your comment that stats can't help it.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 20:09:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230753#M68423</guid>
      <dc:creator>riotto</dc:creator>
      <dc:date>2016-08-16T20:09:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230754#M68424</link>
      <description>&lt;P&gt;If it's a pure xml and if you've setup proper search time field extraction for xml data, then you'd see your fields on the left hand side field bar. &lt;BR /&gt;
&lt;A href="http://docs.splunk.com/Documentation/Splunk/6.4.2/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles#Setting_KV_MODE_for_search-time_data"&gt;http://docs.splunk.com/Documentation/Splunk/6.4.2/Knowledge/Createandmaintainsearch-timefieldextractionsthroughconfigurationfiles#Setting_KV_MODE_for_search-time_data&lt;/A&gt;&lt;/P&gt;

&lt;P&gt;Could you just run your base search (before xmlkv) in Smart/Verbose mode and check if you get the field clientid or not. Remember that field names are always case sensitive in all commands, so check that as well.&lt;/P&gt;

&lt;P&gt;May be you can post a sample xml raw event so that we can check what the field name would look like.&lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 20:40:06 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230754#M68424</guid>
      <dc:creator>somesoni2</dc:creator>
      <dc:date>2016-08-16T20:40:06Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230755#M68425</link>
      <description>&lt;P&gt;I guess you were missing something in your xmlkv .. run the below search and look for the field client ip&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="personalizedoffer" earliest="08/16/2016:00:00:00" (XML_INPUT_LOGGER AND offerInquiryRequest) OR "EnVisionResponse version"   | xmlkv | table _time, clientid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;If clientid field available use the below search to look for the chars,&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="personalizedoffer" earliest="08/16/2016:00:00:00" (XML_INPUT_LOGGER AND offerInquiryRequest) OR "EnVisionResponse version"   | xmlkv | table _time, clientid| eval length=length(clientid)
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Suppose the clientid field is null for some events use fillnull and try below&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index="personalizedoffer" earliest="08/16/2016:00:00:00" (XML_INPUT_LOGGER AND offerInquiryRequest) OR "EnVisionResponse version"   | xmlkv |fillnull value=0 clientid | stats range(_time) as duration by clientid
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;Other aspects to debug, In-case the clientid field has some empty char then try to trim it and use. &lt;/P&gt;

&lt;P&gt;My guess is xmlkv is not extracting the field you were refereeing in the search / doesn't have any values , Hope this will help you. &lt;/P&gt;</description>
      <pubDate>Tue, 16 Aug 2016 20:50:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230755#M68425</guid>
      <dc:creator>vasanthmss</dc:creator>
      <dc:date>2016-08-16T20:50:12Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230756#M68426</link>
      <description>&lt;P&gt;If I do this &lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="personalizedoffer" earliest="08/16/2016:00:00:00" (XML_INPUT_LOGGER AND offerInquiryRequest) OR "EnVisionResponse version"   | xmlkv
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;the clientid shows up as an "interesting field" - If I select it for display in "Table" mode, it displays correctly.&lt;/P&gt;

&lt;P&gt;when I use &lt;STRONG&gt;&lt;EM&gt;your&lt;/EM&gt;&lt;/STRONG&gt; search:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="personalizedoffer" earliest="08/16/2016:00:00:00" (XML_INPUT_LOGGER AND offerInquiryRequest) OR "EnVisionResponse version"   | xmlkv | table _time, clientid   
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;&lt;STRONG&gt;shows an empty field for the clientid when I search&lt;/STRONG&gt;&lt;/P&gt;

&lt;P&gt;Each event has a clientid field in it and it is populated. &lt;/P&gt;

&lt;P&gt;Why does it display when selected, but not  display in the  &lt;CODE&gt;...| table _time clientid&lt;/CODE&gt;?&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 13:49:08 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230756#M68426</guid>
      <dc:creator>riotto</dc:creator>
      <dc:date>2016-08-17T13:49:08Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230757#M68427</link>
      <description>&lt;P&gt;Try with "transaction" command for grouping&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index="personalizedoffer" earliest="08/16/2016:00:00:00" (XML_INPUT_LOGGER AND offerInquiryRequest) OR "EnVisionResponse version"   | xmlkv | transaction clientid | table duration, clientid
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 17 Aug 2016 14:06:55 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230757#M68427</guid>
      <dc:creator>pasokkum</dc:creator>
      <dc:date>2016-08-17T14:06:55Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230758#M68428</link>
      <description>&lt;P&gt;It's clientId, not clientid. That was the problem - I guess I need new glasses&lt;/P&gt;</description>
      <pubDate>Wed, 17 Aug 2016 14:54:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230758#M68428</guid>
      <dc:creator>riotto</dc:creator>
      <dc:date>2016-08-17T14:54:45Z</dc:date>
    </item>
    <item>
      <title>Re: Why am I unable to group by an xmlkv field?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230759#M68429</link>
      <description>&lt;P&gt;If you were trying to perform some sort of math function to it. avg() sum() etc. Anyway glad your eyesight improved.&lt;/P&gt;</description>
      <pubDate>Fri, 19 Aug 2016 04:45:26 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Why-am-I-unable-to-group-by-an-xmlkv-field/m-p/230759#M68429</guid>
      <dc:creator>JDukeSplunk</dc:creator>
      <dc:date>2016-08-19T04:45:26Z</dc:date>
    </item>
  </channel>
</rss>

