Loki Sort Log by Field

Is it possible to sort logs by fields in Loki?

I have a use case I am trying to find a solution for. I have access log and error log from Nginx, and I would like to find the rate of number of requests per IP. But since there are thousands of IPs, it’s not feasible to put that on a Grafana dashboard, so I’d like sort it by number of requests and display only perhaps the top 50 or 100.

Is this possible with Loki query?


Shameless bump. Does anyone have any advice?