Hi! I want to download to txt all 20k+ logs that my query returned. But I see that I can download just something that I can view on web interface — max 5k. I understand that I can download them by parts if will play with time or another filters, but are any ways to download all? Or is it maybe good idea for new feature?
You can do this with LogCLI: LogCLI | Grafana Loki documentation
Hi!
Loki rejects queries that ask for more lines than its max_entries_limit_per_query setting (default 5000), so about 5k is the most Explore can load. Grafana’s download only exports the lines Explore loaded, so it stops there too.
To export everything, use logcli. It fetches results in batches, so it can go past that limit:
export LOKI_ADDR=http://<your-loki>:3100
logcli query '{app="myapp"}' \
--from="2026-11-18T00:00:00Z" --to="2026-11-19T00:00:00Z" \
--limit=100000 -o raw > logs.txt
--limit is the total number of lines to fetch (the default is only 30), so set it above your expected count.
-o raw writes only the log lines. Remove it if you want timestamps and labels.
If your Loki needs auth, set LOKI_USERNAME and LOKI_PASSWORD (or LOKI_BEARER_TOKEN) as environment variables.
A built in “export all results” option is a reasonable feature request.
Check the Grafana GitHub issues for an existing one to upvote before opening a new one.
If you’re not using Loki, let us know which data source it is and we can suggest the right approach.