-
Notifications
You must be signed in to change notification settings - Fork 3.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get all logs through the /loki/api/v1/tail interface #4489
Comments
I got the same problem. |
@sandeepsukhani Can you help us for this problem? thank you so much |
Is there a particular reason to use |
@jeschkies |
Ah, you mean the request didn't return all entries even though it was not exceeding the limit? This may be a silly question but how did you verify the actual number of entries? Did you use GET /loki/api/v1/query? I'm trying to figure out whether the endpoint has a bug. |
@jeschkies |
The tail endpoint is not built with the intention of providing all logs for a stream, the primary use case was for a person to watch a stream of logs in near real-time. The lookback is a rather simplistic implementation to mimic the behavior of I would also comment that there are no guarantees with the current implementation that logs can't be missed, if you try to execute a very large query, you can very likely miss log lines between when that query returns and the live tailing starts. The tail history is just a query that executes with a normal None of Loki's API's are currently built for returning very large results, the most reliable way to do this would be to make repeated calls to the query_range endpoint (which is what logcli does) to work within the batch limits. Loki's API's and primary use case is for human interaction, we do discuss machine to machine API's and interfaces regularly and I know this will be added, but in the meantime a form of polling the query_range endpoint is going to be the most reliable way to get logs. |
Hi! This issue has been automatically marked as stale because it has not had any We use a stalebot among other tools to help manage the state of issues in this project. Stalebots are also emotionless and cruel and can close issues which are still very relevant. If this issue is important to you, please add a comment to keep it open. More importantly, please add a thumbs-up to the original issue entry. We regularly sort for closed issues which have a We may also:
We are doing our best to respond, organize, and prioritize all issues but it can be a challenging task, |
give an example of loki/api/v1/tail |
Describe the bug
Through the documentation, it is found that the /loki/api/v1/tail interface has a limit parameter to set the maximum number of entries to be returned, but I set 200,000, and the number of logs that can be seen is only about 2,000.
To Reproduce
My request connection is as follows: ws://xxx.com/logger/push/loki/api/v1/tail?query={record_step_uuid="74c134467d1b43eebe57467f98aaf01f"}&start=1633676882285000000&limit=200000
Expected behavior
Able to display the number of logs around 200,000
Environment:
Screenshots, Promtail config, or terminal output
Only able to display logs of about 2000 lines
The text was updated successfully, but these errors were encountered: