<?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: Group By Field in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212970#M187928</link>
    <description>&lt;P&gt;Hi @woodcock, thank you for coming back to me with this, but unfortunately it didn't work properly.&lt;/P&gt;

&lt;P&gt;Although, this did group by the nino, it took away the correct values for the associated "activityList" and "selectList".&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
    <pubDate>Thu, 05 Nov 2015 06:39:59 GMT</pubDate>
    <dc:creator>IRHM73</dc:creator>
    <dc:date>2015-11-05T06:39:59Z</dc:date>
    <item>
      <title>Group By Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212966#M187924</link>
      <description>&lt;P&gt;Hi, I wonder whether someone may be able to help me please.&lt;/P&gt;

&lt;P&gt;I'm running the query below which works fine.&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=main auditSource="iht" auditType=Questionnaire "detail.version"=1 | rename detail.activity  AS activity, detail.easytouse  AS select, detail.nino AS nino | eval activity=if(activity=="","Not filled",activity) | makemv allowempty=true delim="," activity| mvexpand activity | eval activity = case(activity ==1, "Register", activity==2, "Provide asset information", activity==3, "Provide gift information", activity==4, "Provide debt information", activity==5, "Provide exemption information", activity==6, "Increase Threshold", activity==7, "Check estate report", activity==8, "Declare and submit application", activity==9,"Request clearance", 1=1, activity) | eval select = case(select ==1, "Very easy", select==2,"Easy",select==3,"Neither easy nor difficult",select=4,"Difficult",select==5,"Very difficult",select=="","Not filled") | rex field=nino mode=sed "s/(\S{1})\S{1}/\1X/g" | stats list(activity) as activityList, values(select) as selectList, values(generatedAt) as timeList by nino, generatedAt| fields nino, timeList, activityList, selectList| sort nino, timeList
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But what I'm trying to do is now group this by the nino field.&lt;/P&gt;

&lt;P&gt;I've tried changing the final two pipes with this:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;| stats count by nino | fields nino, timeList, activityList, selectList
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;But the problem is, is that although I can see the nino values, all the other fields are blank i.e. timeList, activityList, selectList&lt;/P&gt;

&lt;P&gt;I just wondered whether someone may be able to tell me where I've gone wrong please.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 11:35:10 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212966#M187924</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-11-04T11:35:10Z</dc:date>
    </item>
    <item>
      <title>Re: Group By Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212967#M187925</link>
      <description>&lt;P&gt;All, I just wanted let you know I've fixed this with:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt; index=main auditSource="iht-frontend" auditType=Questionnaire "detail.version"=1 | rename detail.activity  AS activity, detail.easytouse  AS select, detail.nino AS nino | eval activity=if(activity=="","Not filled",activity) | makemv allowempty=true delim="," activity| mvexpand activity | eval activity = case(activity ==1, "Register", activity==2, "Provide asset information", activity==3, "Provide gift information", activity==4, "Provide debt information", activity==5, "Provide exemption information", activity==6, "Increase Threshold", activity==7, "Check estate report", activity==8, "Declare and submit application", activity==9,"Request clearance", 1=1, activity) | eval select = case(select ==1, "Very easy", select==2,"Easy",select==3,"Neither easy nor difficult",select=4,"Difficult",select==5,"Very difficult",select=="","Not filled") | eval time=strptime(generatedAt, "%Y-%m-%dT%H:%M:%S")|convert timeformat="%d/%b/%Y %H:%M.%S" ctime(time) | stats list(activity) as activityList, values(select) as selectList, values(time) as timeList by nino, time | fields nino, timeList, activityList, selectList| sort nino, timeList| rex field=nino mode=sed "s/(\S{1})\S{1}/\1X/g" | stats values(activityList) values(selectList) by timeList
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;This doesn't group by nino as I would have liked but I went for second best and grouped by the "timeList" i.e. "generatedAt" time.&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 12:01:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212967#M187925</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-11-04T12:01:59Z</dc:date>
    </item>
    <item>
      <title>Re: Group By Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212968#M187926</link>
      <description>&lt;P&gt;This should work:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;index=main auditSource="iht" auditType=Questionnaire "detail.version"=1 | rename detail.activity  AS activity, detail.easytouse  AS select, detail.nino AS nino | eval activity=coalesce(activity, "Not filled") | makemv allowempty=true delim="," activity| mvexpand activity | eval activity = case(activity ==1, "Register", activity==2, "Provide asset information", activity==3, "Provide gift information", activity==4, "Provide debt information", activity==5, "Provide exemption information", activity==6, "Increase Threshold", activity==7, "Check estate report", activity==8, "Declare and submit application", activity==9,"Request clearance", true(), activity) | eval select = case(select ==1, "Very easy", select==2,"Easy",select==3,"Neither easy nor difficult",select=4,"Difficult",select==5,"Very difficult",select=="","Not filled") | rex field=nino mode=sed "s/(\S{1})\S{1}/\1X/g" | stats list(activity) as activityList, values(select) as selectList, values(generatedAt) as timeList by nino
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 04 Nov 2015 14:15:41 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212968#M187926</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-04T14:15:41Z</dc:date>
    </item>
    <item>
      <title>Re: Group By Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212969#M187927</link>
      <description>&lt;P&gt;You should click "Accept" for the best answer.&lt;/P&gt;</description>
      <pubDate>Wed, 04 Nov 2015 16:10:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212969#M187927</guid>
      <dc:creator>woodcock</dc:creator>
      <dc:date>2015-11-04T16:10:16Z</dc:date>
    </item>
    <item>
      <title>Re: Group By Field</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212970#M187928</link>
      <description>&lt;P&gt;Hi @woodcock, thank you for coming back to me with this, but unfortunately it didn't work properly.&lt;/P&gt;

&lt;P&gt;Although, this did group by the nino, it took away the correct values for the associated "activityList" and "selectList".&lt;/P&gt;

&lt;P&gt;Many thanks and kind regards&lt;/P&gt;

&lt;P&gt;Chris&lt;/P&gt;</description>
      <pubDate>Thu, 05 Nov 2015 06:39:59 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Group-By-Field/m-p/212970#M187928</guid>
      <dc:creator>IRHM73</dc:creator>
      <dc:date>2015-11-05T06:39:59Z</dc:date>
    </item>
  </channel>
</rss>

