Get count of each log contents

Hi, i have log file in grafana using loki data source the problem is i want to make table in grafana for specific messages in the log . multiple methods of msg in the logs. so i need two coloumn one is msg type or method another coulmn is count of each methods. in the screenshot i need to get count of that msg type how many time it occurs within the hour or minute.