<?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 Grouping data by multiple attribute values in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546395#M154899</link>
    <description>&lt;P&gt;I have basic web logs with username and jsessionid. I want to group (assume a single index, with one set of data). So thousands of events.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to group by jsessionid and username - creating supergroups. Example:&lt;/P&gt;&lt;P&gt;username:jsessionid&lt;/P&gt;&lt;P&gt;tom:1234&lt;/P&gt;&lt;P&gt;frank:1234&lt;/P&gt;&lt;P&gt;bob:1234&lt;/P&gt;&lt;P&gt;bob:5467&lt;/P&gt;&lt;P&gt;sally:5467&lt;/P&gt;&lt;P&gt;sally:9012&lt;/P&gt;&lt;P&gt;amy:9012&lt;/P&gt;&lt;P&gt;harry:4709&lt;/P&gt;&lt;P&gt;tony:4709&lt;/P&gt;&lt;P&gt;I would wind up with 2 groups - a small group with just harry and tony, and a larger group with tom, frank, bob, sally, and amy due to shared jsessionid.&lt;/P&gt;&lt;P&gt;I would like my output to contain some kind of group ID or Group Name. I would have no knowledge of username or jsessionid - I just want to be able to loop through the data and assign users/jsessionids to groups where they exist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first thought is to sort by jsessionid, but I can't figure out how to loop through the data and create dynamic group names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any ideas, not an SPL expert.&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Thu, 01 Apr 2021 16:07:52 GMT</pubDate>
    <dc:creator>alphadog00</dc:creator>
    <dc:date>2021-04-01T16:07:52Z</dc:date>
    <item>
      <title>Grouping data by multiple attribute values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546395#M154899</link>
      <description>&lt;P&gt;I have basic web logs with username and jsessionid. I want to group (assume a single index, with one set of data). So thousands of events.&amp;nbsp;&lt;/P&gt;&lt;P&gt;I want to group by jsessionid and username - creating supergroups. Example:&lt;/P&gt;&lt;P&gt;username:jsessionid&lt;/P&gt;&lt;P&gt;tom:1234&lt;/P&gt;&lt;P&gt;frank:1234&lt;/P&gt;&lt;P&gt;bob:1234&lt;/P&gt;&lt;P&gt;bob:5467&lt;/P&gt;&lt;P&gt;sally:5467&lt;/P&gt;&lt;P&gt;sally:9012&lt;/P&gt;&lt;P&gt;amy:9012&lt;/P&gt;&lt;P&gt;harry:4709&lt;/P&gt;&lt;P&gt;tony:4709&lt;/P&gt;&lt;P&gt;I would wind up with 2 groups - a small group with just harry and tony, and a larger group with tom, frank, bob, sally, and amy due to shared jsessionid.&lt;/P&gt;&lt;P&gt;I would like my output to contain some kind of group ID or Group Name. I would have no knowledge of username or jsessionid - I just want to be able to loop through the data and assign users/jsessionids to groups where they exist.&amp;nbsp;&lt;/P&gt;&lt;P&gt;My first thought is to sort by jsessionid, but I can't figure out how to loop through the data and create dynamic group names.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks for any ideas, not an SPL expert.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 16:07:52 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546395#M154899</guid>
      <dc:creator>alphadog00</dc:creator>
      <dc:date>2021-04-01T16:07:52Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data by multiple attribute values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546400#M154901</link>
      <description>&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;you could try with next&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;....
| eval group = case (username == "harry" OR username == "tom", "grp1", true(), "grp2")
| stats values(*) as * by group, jsessiond
| ....&lt;/LI-CODE&gt;&lt;P&gt;please check the syntax as I haven’t splunk in my hands to check it.&lt;/P&gt;&lt;P&gt;r. Ismo&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 17:06:05 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546400#M154901</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-04-01T17:06:05Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data by multiple attribute values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546401#M154902</link>
      <description>&lt;P&gt;thanks, but if I have no idea of username or group names - i need to create groups there could "n" groups, and the case statement would have to be built with unknown usernames - that is part of my sticking point.&lt;/P&gt;&lt;P&gt;I also have a "X" usernames and "Y" jsessionids&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 17:09:27 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546401#M154902</guid>
      <dc:creator>alphadog00</dc:creator>
      <dc:date>2021-04-01T17:09:27Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data by multiple attribute values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546402#M154903</link>
      <description>How you could group those without knowing which names belongs to which group?</description>
      <pubDate>Thu, 01 Apr 2021 17:13:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546402#M154903</guid>
      <dc:creator>isoutamo</dc:creator>
      <dc:date>2021-04-01T17:13:36Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data by multiple attribute values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546403#M154904</link>
      <description>&lt;P&gt;To clarify, I could have thousands of sessionIDs and since Tom shares different jsessionids with multiple different people, and they share jsessionids with others, this would be one big group.&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 17:16:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546403#M154904</guid>
      <dc:creator>alphadog00</dc:creator>
      <dc:date>2021-04-01T17:16:39Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data by multiple attribute values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546407#M154905</link>
      <description>&lt;P&gt;If you look at this data:&lt;/P&gt;&lt;P&gt;tom:1234&lt;/P&gt;&lt;P&gt;frank:1234&lt;/P&gt;&lt;P&gt;bob:1234&lt;/P&gt;&lt;P&gt;bob:5467&lt;/P&gt;&lt;P&gt;sally:5467&lt;/P&gt;&lt;P&gt;sally:9012&lt;/P&gt;&lt;P&gt;amy:9012&lt;/P&gt;&lt;P&gt;- tom, frank, bob are connected via one JSESSIONID, bob and sally by another, so sally has an indirect or transitive relationship to tom and frank. Amy is connected to Sally - so in the end, all of these above are part of one big group due some direct and indirect relationships&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 17:36:16 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546407#M154905</guid>
      <dc:creator>alphadog00</dc:creator>
      <dc:date>2021-04-01T17:36:16Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data by multiple attribute values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546421#M154910</link>
      <description>&lt;P&gt;This sort of works - the issue is knowing how many iterations to do to resolve all the indirections&lt;/P&gt;&lt;LI-CODE lang="markup"&gt;| makeresults | eval _raw="tom:1234

frank:1234

bob:1234

bob:5467

sally:5467

sally:9012

amy:9012

harry:4709

tony:4709"
| multikv noheader=t 
| rex "(?&amp;lt;username&amp;gt;[^\:]+)\:(?&amp;lt;jsessionid&amp;gt;.+)"
| fields - _raw _time
| fields username jsessionid
| eventstats values(jsessionid) as jsessionids by username
| eventstats values(username) as usernames by jsessionid
| eventstats values(jsessionids) as jsessionidss by usernames
| eventstats values(usernames) as usernamess by jsessionids
| eventstats values(jsessionidss) as jsessionidsss by usernamess
| eventstats values(usernamess) as usernamesss by jsessionidss
| eventstats values(jsessionidsss) as jsessionidssss by usernamesss
| eventstats values(usernamesss) as usernamessss by jsessionidsss
| eventstats values(jsessionidssss) as jsessionidsssss by usernamessss
| eventstats values(usernamessss) as usernamesssss by jsessionidssss
| eval supergroup=mvjoin(usernamesssss,",")
| dedup supergroup
| table supergroup&lt;/LI-CODE&gt;</description>
      <pubDate>Thu, 01 Apr 2021 19:12:58 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546421#M154910</guid>
      <dc:creator>ITWhisperer</dc:creator>
      <dc:date>2021-04-01T19:12:58Z</dc:date>
    </item>
    <item>
      <title>Re: Grouping data by multiple attribute values</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546425#M154912</link>
      <description>&lt;P&gt;thanks, the data is actually a little cleaner - i did username:sessionid for this post, really they are already separate fields of data in the index.&amp;nbsp; But i will try what you posted. I had looked at eventstats, but not gone to this level&lt;/P&gt;</description>
      <pubDate>Thu, 01 Apr 2021 19:27:00 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Grouping-data-by-multiple-attribute-values/m-p/546425#M154912</guid>
      <dc:creator>alphadog00</dc:creator>
      <dc:date>2021-04-01T19:27:00Z</dc:date>
    </item>
  </channel>
</rss>

