group by and logs