<?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 and filter query in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/628073#M218199</link>
    <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253010"&gt;@anrak33&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
    <pubDate>Tue, 24 Jan 2023 07:39:46 GMT</pubDate>
    <dc:creator>gcusello</dc:creator>
    <dc:date>2023-01-24T07:39:46Z</dc:date>
    <item>
      <title>How to create a search for group by and filter query?</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627427#M218028</link>
      <description>&lt;P&gt;My data looks like the following&amp;nbsp;&lt;/P&gt;
&lt;TABLE border="1" width="100%"&gt;
&lt;TBODY&gt;
&lt;TR&gt;
&lt;TD width="20%" height="25px"&gt;&lt;EM&gt;student_id&lt;/EM&gt;&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;&lt;EM&gt;browser_id&lt;/EM&gt;&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;&lt;EM&gt;guid&lt;/EM&gt;&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;&lt;EM&gt;datetime&lt;/EM&gt;&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;&lt;EM&gt;x_id&lt;/EM&gt;&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="25px"&gt;12_a&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;Chrome_2&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1122&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1/9/23 14:45&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;788a&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="25px"&gt;13_a&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;Chrome_4&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1213&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1/12/23 19:13&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;33b&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="25px"&gt;14_a&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;Chrome_3&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1422&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1/13/23 1:42&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;24c&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="25px"&gt;15_b&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;FireFox_1&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1289&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1/16/23 15:46&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;&amp;nbsp;12d&lt;/TD&gt;
&lt;/TR&gt;
&lt;TR&gt;
&lt;TD width="20%" height="25px"&gt;12_a&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;Chrome_2&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1132&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;1/11/23 21:50&lt;/TD&gt;
&lt;TD width="20%" height="25px"&gt;788a&lt;/TD&gt;
&lt;/TR&gt;
&lt;/TBODY&gt;
&lt;/TABLE&gt;
&lt;P&gt;&lt;BR /&gt;Ideally, we shouldn't have different guids given same student_id, browser_id and x_id. I am trying to find all those student_ids who violate this rule aka student_ids with same browser_id and x_id but different guid. So for the above, I'd like to see something like -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;12_a Chrome_2 1122 1/9/23 14:45 788a
12_a Chrome_2 1132 1/11/23 21:50 788a&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;BR /&gt;I am trying -&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;index="main_idx" app="student_svc"
| stats count by student_id browser_id guid datetime x_id
| where count &amp;gt; 1
| stats list(count) by student_id&lt;/LI-CODE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;But it doesn't seem to be yielding the result. What should be the fix? Thanks&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 15:11:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627427#M218028</guid>
      <dc:creator>anrak33</dc:creator>
      <dc:date>2023-01-24T15:11:39Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and filter query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627429#M218029</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253010"&gt;@anrak33&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;let me understand: for each student_id you should have only one&amp;nbsp;&lt;SPAN&gt;uids, browser_id and x_id, is it correct?&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;if this is your need, you should try to use dc function in stats command, so to have the ex eption you could run&amp;nbsp;something like this:&lt;/SPAN&gt;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main_idx" app="student_svc"
| stats 
   dc(browser_id) AS browser_id_count 
   dc(guid) AS guid_count 
   dc(x_id) AS x_id_count 
   BY student_id
| where browser_id_count&amp;gt;1 OR guid_count&amp;gt;1 OR x_id_count&amp;gt;1&lt;/LI-CODE&gt;&lt;P&gt;See my approach and adapt my sample to your needs.&lt;/P&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 07:21:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627429#M218029</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-18T07:21:39Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and filter query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627431#M218030</link>
      <description>&lt;P&gt;Thanks&amp;nbsp;&lt;SPAN&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp; - it seems close - one thing I want to get rid of in the search is empty guid - how to add that?&lt;BR /&gt;And the problem statement is for&amp;nbsp;each (student_id + browser_id + x_id) there should be one guid.&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 07:48:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627431#M218030</guid>
      <dc:creator>anrak33</dc:creator>
      <dc:date>2023-01-18T07:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and filter query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627437#M218032</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253010"&gt;@anrak33&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;please try this:&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;index="main_idx" app="student_svc"
| fillnull guid value="empty"
| stats 
   dc(browser_id) AS browser_id_count 
   dc(guid) AS guid_count 
   dc(x_id) AS x_id_count 
   dc(eval(if(guid="empty",1,0))) AS empty_guid_count
   BY student_id
| where browser_id_count&amp;gt;1 OR guid_count&amp;gt;1 OR x_id_count&amp;gt;1 OR empty_guid_count&amp;gt;0&lt;/LI-CODE&gt;&lt;P&gt;Ciao.&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;</description>
      <pubDate>Wed, 18 Jan 2023 09:53:20 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627437#M218032</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-18T09:53:20Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and filter query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627948#M218160</link>
      <description>&lt;P&gt;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/161352"&gt;@gcusello&lt;/a&gt;&amp;nbsp;thx&amp;nbsp; - this is not exactly giving me the result I want though.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want all the student_ids who has more than 1 guid for a particular browser_id and x_id combination.&lt;/P&gt;&lt;P&gt;I tried changing the ORs to ANDs but no luck.&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 08:33:53 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627948#M218160</guid>
      <dc:creator>anrak33</dc:creator>
      <dc:date>2023-01-23T08:33:53Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and filter query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627950#M218162</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253010"&gt;@anrak33&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;you can add also&amp;nbsp;&lt;SPAN&gt;browser_id and x_id&amp;nbsp;to the grouping keys or buid a different where condition, in this case, remember to use paranthesis.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Ciao.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;Giuseppe&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 23 Jan 2023 08:42:09 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/627950#M218162</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-23T08:42:09Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and filter query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/628072#M218198</link>
      <description>&lt;P&gt;thanks&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 07:36:54 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/628072#M218198</guid>
      <dc:creator>anrak33</dc:creator>
      <dc:date>2023-01-24T07:36:54Z</dc:date>
    </item>
    <item>
      <title>Re: Group by and filter query</title>
      <link>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/628073#M218199</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.splunk.com/t5/user/viewprofilepage/user-id/253010"&gt;@anrak33&lt;/a&gt;,&lt;/P&gt;&lt;P&gt;good for you, see next time!&lt;/P&gt;&lt;P&gt;Ciao and happy splunking&lt;/P&gt;&lt;P&gt;Giuseppe&lt;/P&gt;&lt;P&gt;P.S.: Karma Points are appreciated &lt;span class="lia-unicode-emoji" title=":winking_face:"&gt;😉&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 24 Jan 2023 07:39:46 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/How-to-create-a-search-for-group-by-and-filter-query/m-p/628073#M218199</guid>
      <dc:creator>gcusello</dc:creator>
      <dc:date>2023-01-24T07:39:46Z</dc:date>
    </item>
  </channel>
</rss>

