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
Fix duplicate logs from docker containers #11563
Conversation
Trivy scan found the following vulnerabilities:
|
bump |
A test should be added here to show the bug and that this is fixing it. |
@cstyan I would like to point out few things:
This is non-trivial and requires lots of work for a simple bug in logic. Feel like too much for this. |
Given that it's been more than a year since someone on our team looked into it and we don't use the promtail with THE docker target ourselves (and actually aren't running promtail anymore, we run https://github.com/grafana/agent so this fix is likely relevant to them as well), some kind of a test to validate the behaviour feels like a reasonable ask. On paper this does seem like the right fix, your explanation of the root cause makes sense. There's an existing test in |
@cstyan gotcha, your suggested approach indeed is simpler and doesn't require this much work. I've added tests to this bug, can you check? |
Very nice, confirmed the test fails without the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
green, lgtm
@ptqa not sure what the cause of the conflict is but since there isn't a file specified my first assumption is that it's within your fork somehow? I'd suggest merging |
@cstyan yeah it's a CHANGELOG file, I've merged main branch |
@ptqa awesome, thanks for your contribution and patience |
@cstyan thank you for the guidance and merging this PR |
This fixes various issues with docker_sd on promtail. Mostly related to duplicate logs being send to loki from promtail. Root case of issue is that positions file is updated after process function, but in memory field `since` of `Target` struct is not updated.
This fixes various issues with docker_sd on promtail. Mostly related to duplicate logs being send to loki from promtail.
Root case of issue is that positions file is updated after process function, but in memory field
since
ofTarget
struct is not updated.Which issue(s) this PR fixes:
Fixes #7382 #7103 and some others
Special notes for your reviewer:
Checklist
CONTRIBUTING.md
guide (required)CHANGELOG.md
updatedadd-to-release-notes
labeldocs/sources/setup/upgrade/_index.md
production/helm/loki/Chart.yaml
and updateproduction/helm/loki/CHANGELOG.md
andproduction/helm/loki/README.md
. Example PRdeprecated-config.yaml
anddeleted-config.yaml
files respectively in thetools/deprecated-config-checker
directory. Example PR