Hello,
May be this can work for you possibly.
1.Try to save the output of last to a file
2.Parse the file , using file api's of the language you are using(assuming
java file i/o)
3.Extract unique user login information and save them to a List
Hope this helps