- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Hello dear Splunkers,
I have a table showing the amount of downloaded data per website by user on my network.
Is it possible to sort this table based on two fields? I need the "sort" to put priority on the total downloaded amount per user and then the total amount downloaded per website.
This means there will be two sorts: the first sort will fix up all the users that downloaded the most in a way to get the user that downloaded the most on top of the list (regardless of the webpages the accessed). The second sort will set the most bandwidth consuming webpage per user in order. That makes the table show the top users and top websites per top users (hope that's not too complicated).
Here are the fields being used:
User : The user
webpage : The accessed webpage
BWu : Bandwidth per User
BWs : Bandwidth per webpage
Regards,
David
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

You can stack sort
arguments like this:
...
| sort 0 -BWu -BWs
But what I suspect you really desire is something like this:
...
| sort 0 -count
| stats list(BWs) AS BWs list(webpage) AS webpage sum(BWs) AS BWu BY User
| sort 0 -BWu
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

You can stack sort
arguments like this:
...
| sort 0 -BWu -BWs
But what I suspect you really desire is something like this:
...
| sort 0 -count
| stats list(BWs) AS BWs list(webpage) AS webpage sum(BWs) AS BWu BY User
| sort 0 -BWu
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

|sort -BWu -BWs +Username
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi DavidHourani
try this search code
.....|stats count by User webpage |top limit=0 User webpage |appendcols[search .....|stats count by BWu BWs |top limit=0 BWu BWs]
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

hi DavidHourani,
you search corresponding |stats count by field1, field2, field3, field4 |sort -count
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for your reply Gys, I need to have double sorting, one based on BWu and one on BWs, in your case I only have sorting on count right ?
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

try like this: you search corresponding |stats count by BWu , BWs |sort -count
- Mark as New
- Bookmark Message
- Subscribe to Message
- Mute Message
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content

Thanks for the tip, it doesn't work though. The sort should be based on BWu and BWs not on the count. because the count is equal to 1 for all the values 🙂
