-
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
A Docker service discovery to Promtail #4703
Comments
This work was fairly recently merged into Prometheus: prometheus/prometheus#8629 which is where Promtail gets its service discovery code which I believe could fairly easily be supported in Promtail. |
This is awesome! Do you think it would be feasible to scrape the logs from the API then? |
FYI: At the moment I use following work-around:
Disadvantages
|
Addresses grafana#2361 Closes grafana#4703
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, |
Work is in progress. |
**What this PR does / why we need it**: This patch adds support to fetch Docker container logs through the Docker daemon API. This should be more robust than the Loki Docker driver or scraping the logs files. The new Docker target will also collect meta information of the scraped containers. **Which issue(s) this PR fixes**: Addresses #2361 Closes #4703 **Special notes for your reviewer**: **Checklist** - [x] Documentation added - [x] Tests updated - [x] Add an entry in the `CHANGELOG.md` about the changes.
@jeschkies Sorry if this is the wrong place to post something like this, but as this isn't in the latest release yet, a bug report would be inappropriate I think. I was just testing the new docker_sd_config. Everything worked like a charm, until I noticed something weird. When I restart a container, from which I scrape logs with the docker_sd_config, promtail seems to not send the logs to loki. All other containers still work fine. When I then restart promtail, all the missing logs get delivered at once. So nothing is missing, but after the restart it seems to stop sending the logs of this specific container to loki. Is this something you can maybe reproduce? |
Thanks for testing the implementation 🙏 Could you file a new issue? Interesting. I thought I covered that case. How long did you wait? The new container should be discovered after some time. Did the container change its id? There might be an issue if the container keeps its id. |
#5259 Created an issue.
|
Today I tried Promtail 2.5.0 and configured it for Docker Containers. Unfortunately, it didn't work. Promtail service didn't start. Promtail configuration:
Service configuration:
Unix socket:
I tested it manually with Groups:
Unfortunately Promtail always shows that it restarted too quickly. This happens if the configuration is wrong or a permission is missing. A more meaningful error message would help. Any hint, what I did wrong? |
I fixed my problem with Docker configuration, but now I get:
@jeschkies Do you have any hint for me? |
🤔 that seems like a Loki connection error. Could you try another target to verify that your client setup is correct? |
After restarting the docker container it worked. Maybe the message comes if no new logs are available? Thank you. |
Ah, that could be. I've never tested it without logs I think. |
I got the same problem.
I will get containers info if I drop the filters option. but I coud't got the container log file path in the Promtail dashboard even if I configure the path label .
The other problem is seems that the relabel_configs is not work with docker_sd_configs. |
@Bamboer could you file a new ticket? That'd be a little easier to track. |
|
I writed a new docker model for promtail to fix container label lose problem.
|
Is your feature request related to a problem? Please describe.
We have use cases when it is not desirable to ship Docker container logs via the Docker driver but with Promtail. See e.g. #2361.
Describe the solution you'd like
We could offer Docker container discovery alongside the Kubernetes service discovery. The discovery would be pointed at the Docker daemon and fetch all containers and then their logs.
Describe alternatives you've considered
It is possible to point Promtail to the Docker logs files. However, the Promtail process would require access to the log files.
The text was updated successfully, but these errors were encountered: