What bin does is 'smoosh' , in this case, the time field so that all of the dates appear the same (essentially midnight of the day in question). I'm doing this because now you can run your query across a number of days - 7, 30, etc - and get the unique number of days a user might have logged in. To see this in action you could do something like
...| eval foo = _time | bin span=1d _foo | convert ctime(foo) | table _time foo
Even though you've smooshed (quite a technical term I must say) the time field you still have individual login instances which allows you to also get a total count of logins per user & database.
Sorting is simply a matter of picking which field you want and of course you can sort on multiple fields. Hopefully that helps a bit.
... View more