Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Merged

Conversation

tpaschalis
Copy link
Member

@tpaschalistpaschalis commentedApr 18, 2022
edited
Loading

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

  • Documentation added
  • Tests updated
  • Add an entry in theCHANGELOG.md about the changes.

joshsleeper and v-zhuravlev reacted with thumbs up emojijoshsleeper and v-zhuravlev reacted with hooray emoji
@tpaschalistpaschalis marked this pull request as ready for reviewApril 18, 2022 10:02
Copy link
MemberAuthor

@tpaschalistpaschalisApr 18, 2022
edited
Loading

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>
Signed-off-by: Paschalis Tsilias <paschalis.tsilias@grafana.com>
This reverts commit 17abb006ce141071c4bca4b7d133bea2aa314594.
Copy link
Contributor

@cyriltovenacyriltovena left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

LGTM

tpaschalis reacted with hooray emoji
@cyriltovenacyriltovena merged commit179d741 intografana:mainMay 2, 2022
@tpaschalistpaschalis deleted the add-promtail-exclusion branchMay 2, 2022 11:01
@adam0s9
Copy link

is it please possible to make it exclude two files resp. two different logfiles with no common root (how about 3)?

@tpaschalis
Copy link
MemberAuthor

@adam0s9 hey there 👋

Right now this is not possible with thestatic_configs targets. The workaround is to define more multiple, more fine-grained targets in your scrape configuration to handle nested directories.

If you'd like to propose an enhancement to the way__path_exclude__ works, I'd recommend opening a new issue to start the conversation from scratch and get more eyes on it.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@cyriltovenacyriltovenacyriltovena approved these changes

@KMiller-GrafanaKMiller-GrafanaAwaiting requested review from KMiller-Grafana

Assignees

No one assigned

Labels

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Allow exclusion patterns on Promtail'sstatic_config

3 participants

@tpaschalis@adam0s9@cyriltovena

[8]ページ先頭

©2009-2025 Movatter.jp