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
Promtail: Fix excludepath not evaluated on newly added files #9831
Promtail: Fix excludepath not evaluated on newly added files #9831
Conversation
@SijmenHuizenga Thanks for the contribution, this looks good. Can you write a test that goes along with this change? |
This function is very important, waiting |
@SijmenHuizenga Hello, thanks for your PR. We're currently reevaluating promtails position as a project within Grafana Labs. Internally we're actually using the Agent for both metrics and logs collection at this point. Additionally, the agent team is more likely to have time to dedicate to your PR. We can likely consider this a bugfix and move forward anyways, but as Travis has mentioned a test should be added. While we haven't made a formal decision yet, we expect in the near future that all new feature work will be done in the Agent's log collection pipelines rather than in Promtail. |
God, it's been 4 months ago now. |
Trivy scan found the following vulnerabilities:
|
dc57086
to
b67f354
Compare
Thanks @cstyan for the context about Agent and Promtail. I've added the unit test and rebased onto main. I'm happy to hear if there's anything should be improved. |
@SijmenHuizenga sorry for the delayed response. It looks like there's a test failure on windows related to the go.mod After that we can merge, and I'll notify the agent team of this fix as well so they can include it there. |
@cstyan thank you for explaining how we can move this forward. main has been merged into here. |
…#9831) **What this PR does / why we need it**: In promtail, when a file matching the exclude path is created in a directory that is being watched, this file should not be tailed by promtail. However, previously this was the case. As described in grafana#7115. This change checks the filename to the excludePath and if it matches, ignores the file. **Which issue(s) this PR fixes**: Fixes grafana#7115 **Special notes for your reviewer**: We tested manually this by running Promtail locally and creating a bunch of files which should and should not be tailed by Promtail. **Checklist** - [x] Reviewed the [`CONTRIBUTING.md`](https://github.com/grafana/loki/blob/main/CONTRIBUTING.md) guide (**required**) - [x] Tests updated - [x] `CHANGELOG.md` updated - [ ] If the change is worth mentioning in the release notes, add `add-to-release-notes` label - [ ] Changes that require user attention or interaction to upgrade are documented in `docs/sources/upgrading/_index.md`
What this PR does / why we need it:
In promtail, when a file matching the exclude path is created in a directory that is being watched, this file should not be tailed by promtail. However, previously this was the case. As described in #7115. This change checks the filename to the excludePath and if it matches, ignores the file.
Which issue(s) this PR fixes:
Fixes #7115
Special notes for your reviewer:
We tested manually this by running Promtail locally and creating a bunch of files which should and should not be tailed by Promtail.
Checklist
CONTRIBUTING.md
guide (required)CHANGELOG.md
updatedadd-to-release-notes
labeldocs/sources/upgrading/_index.md