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

add pipeline_stage to remove filename label #455

Closed
wants to merge 7 commits into from
Closed
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
36 changes: 30 additions & 6 deletions lib/charms/loki_k8s/v1/loki_push_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,7 @@ def __init__(self, ...):

# Increment this PATCH version before using `charmcraft publish-lib` or reset
# to 0 if you are raising the major API version
LIBPATCH = 13
LIBPATCH = 14

PYDEPS = ["cosl"]

Expand All @@ -561,18 +561,19 @@ def __init__(self, ...):
# To update Promtail version you only need to change the PROMTAIL_VERSION and
# update all sha256 sums in PROMTAIL_BINARIES. To support a new architecture
# you only need to add a new key value pair for the architecture in PROMTAIL_BINARIES.
PROMTAIL_VERSION = "v2.9.7"

PROMTAIL_VERSION = "v2.9.9"
PROMTAIL_ARM_BINARY = {
"filename": "promtail-static-arm64",
"zipsha": "c083fdb45e5c794103f974eeb426489b4142438d9e10d0ae272b2aff886e249b",
"binsha": "4cd055c477a301c0bdfdbcea514e6e93f6df5d57425ce10ffc77f3e16fec1ddf",
"zipsha": "80ac879c16b8bf926bb2feebc69d4f248c266aea235c5cd1c6a8a9eb751c5633",
"binsha": "550a8b5cbbde3881dacf9d58700a3311fea4996f43cff1dfb60b291a94db8fbd",
}

PROMTAIL_BINARIES = {
"amd64": {
"filename": "promtail-static-amd64",
"zipsha": "6873cbdabf23062aeefed6de5f00ff382710332af3ab90a48c253ea17e08f465",
"binsha": "28da9b99f81296fe297831f3bc9d92aea43b4a92826b8ff04ba433b8cb92fb50",
"zipsha": "41c195e0a0d6ac04a1c0d6bb6fdb3892b9608f0c80059e35340dfc7adb9d65d2",
"binsha": "cc1d3bdb2999c2c0c11b9e3ec32eaea10507c0a3726d77318bde3af5cb4e6f00",
},
"arm64": PROMTAIL_ARM_BINARY,
"aarch64": PROMTAIL_ARM_BINARY,
Expand Down Expand Up @@ -2281,6 +2282,19 @@ def _scrape_configs(self, container_name: str) -> dict:
config = {"targets": ["localhost"], "labels": labels}
scrape_config = {
"job_name": "system",
"pipeline_stages": [
{
"drop": {
"expression": ".*file is a directory.*",
},
},
{
"structured_metadata": {"filename": "filename"},
},
{
"labeldrop": ["filename"],
},
],
"static_configs": self._generate_static_configs(config, container_name),
}
scrape_configs.append(scrape_config)
Expand All @@ -2298,8 +2312,18 @@ def _scrape_configs(self, container_name: str) -> dict:
]
syslog_labels = common_labels.copy()
syslog_labels.update({"job": f"{job_name}_syslog"})
# The job_name should be journal.
# we are not modifying it to avoid backwards compatibility issues.
syslog_config = {
"job_name": "syslog",
"pipeline_stages": [
{
"structured_metadata": {"filename": "filename"},
},
{
"labeldrop": ["filename"],
},
],
"syslog": {
"listen_address": f"127.0.0.1:{syslog_port}",
"label_structured_data": True,
Expand Down
Loading