- Notifications
You must be signed in to change notification settings - Fork3.8k
promtail: Add support for exclusion patterns instatic_config
#5943
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
tpaschalisApr 18, 2022 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
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.
If t.pathExclude is empty, then doublestar.Glob returnsnil, nil
, just skipping the loop below.
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
This reverts commit 17abb006ce141071c4bca4b7d133bea2aa314594.
8a30ff2
to838a8e3
CompareThere 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.
LGTM
adam0s9 commentedJun 26, 2023
is it please possible to make it exclude two files resp. two different logfiles with no common root (how about 3)? |
@adam0s9 hey there 👋 Right now this is not possible with the If you'd like to propose an enhancement to the way |
Uh oh!
There was an error while loading.Please reload this page.
Signed-off-by: Paschalis Tsiliaspaschalis.tsilias@grafana.com
What this PR does / why we need it:
As stated in the linked Issue, there's currently no easy way toexclude files from a Promtail config, except for overly restrictive and/or complex glob patterns.
This addition may be helpful in a number of scenarios, from avoiding usage spikes in Grafana cloud, to having separate pipeline_stages for specific file formats, or filtering directories which Promtail couldn't tail due to permissions.
Since the upstream bmatcuk/doublestar package doesn't support negation patterns, this is another way of achieving the same result.
Which issue(s) this PR fixes:
Fixes#5744
Special notes for your reviewer:
From my local tests, this seems to work as intended both in scrape_config and file_sd_config blocks; let me know if I've missed anything ^^
Checklist
CHANGELOG.md
about the changes.