Hi there,
I’m trying, in some way, to expose the logs from loki endpoint to an external http.
My need, is somehow, to proxy the loki response through another API and query all the logs and returned them.
I’m using the API /loki/api/v1/query_range to fetch logs.
My understanding is that the pagination with loki, is somehow achieved by asking the next “page” that starts after the timestamp of latest row of the previous page.
So, if the query with limit 1000 returned the 999th and 1000th lines as follow:
2025-04-08 13:23:55,717 DEBUG [com.cloudiam...] 999
2025-04-08 13:23:55,788 DEBUG [com.cloudiam...] 1000
Then the next page should ask for the lines starting at 2025-04-08 13:23:55,789, one thousandth after the last row.
But in my case (and in a general manner), log generation can happen at the very same milliseconds:
2025-04-08 13:23:55,717 DEBUG [com.cloudiam...] 999
2025-04-08 13:23:55,788 DEBUG [com.cloudiam...] 1000
2025-04-08 13:23:55,788 DEBUG [com.cloudiam...] 1001
2025-04-08 13:23:55,810 DEBUG [com.cloudiam...] 1002
In that case, the line 1001 is skipped and will never be fetched.
This is even more visible with nginx access logs for instance that are timestamped with a precision of a second.
I’m sure there is a way to achieve that properly, maybe my assumption are wrong and pagination should be handled in a very different way.
Let me know
Thanks in advance
M.