Skip to content
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

feat: add exclude-list for logs in /var/log #216

Merged
merged 5 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -210,3 +210,17 @@ config:
Ref: https://grafana.com/docs/agent/latest/static/configuration/flags/#report-information-usage
type: boolean
default: true
exclude_files:
lucabello marked this conversation as resolved.
Show resolved Hide resolved
description: >
Glob for a set of log files present in `/var/log` that should be ignored by Grafana Agent.

For example, `/var/log/**/{app_one,app_two}.log` will result in the agent ignoring both
`/var/log/app_one.log` and `/var/log/app_two.log`.

Note that the value you provide here is not interpreted as a path, but rather as a glob matcher.
Specifically, if you want to exclude logs in the `/var/log/test` folder, you should set the
config to `/var/log/test/**`.

Ref (__path_exclude__): https://grafana.com/docs/loki/latest/send-data/promtail/scraping/
type: string
default: ""
1 change: 1 addition & 0 deletions src/charm.py
Original file line number Diff line number Diff line change
Expand Up @@ -474,6 +474,7 @@ def _additional_log_configs(self) -> List[Dict[str, Any]]:
"targets": ["localhost"],
"labels": {
"__path__": "/var/log/**/*log",
"__path_exclude__": self.model.config.get("exclude_files"),
"job": "varlog",
**self._own_labels,
},
Expand Down
Loading