caddy: added metrics for caddy access log
This commit is contained in:
parent
4cd08447ae
commit
f9caa0af7f
|
@ -69,5 +69,53 @@ in
|
|||
'';
|
||||
};
|
||||
|
||||
environment.etc."alloy/config.alloy".text =
|
||||
/*hcl*/ ''
|
||||
local.file_match "caddy_access_log" {
|
||||
path_targets = [
|
||||
{
|
||||
"__path__" = "/var/log/caddy/*.log",
|
||||
},
|
||||
]
|
||||
sync_period = "5s"
|
||||
}
|
||||
|
||||
loki.source.file "caddy_access_log" {
|
||||
targets = local.file_match.caddy_access_log.targets
|
||||
forward_to = [loki.process.caddy_access_log.receiver]
|
||||
}
|
||||
|
||||
loki.process "caddy_access_log" {
|
||||
forward_to = [loki.write.default.receiver]
|
||||
|
||||
stage.json {
|
||||
expressions = {
|
||||
level = "",
|
||||
host = "request.host",
|
||||
method = "request.method",
|
||||
proto = "request.proto",
|
||||
}
|
||||
}
|
||||
|
||||
stage.labels {
|
||||
values = {
|
||||
level = "",
|
||||
host = "",
|
||||
method = "",
|
||||
proto = "",
|
||||
}
|
||||
}
|
||||
|
||||
stage.label_drop {
|
||||
values = ["service_name"]
|
||||
}
|
||||
|
||||
stage.static_labels {
|
||||
values = {
|
||||
job = "caddy_access_log",
|
||||
}
|
||||
}
|
||||
}
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
|
|
@ -51,6 +51,10 @@ in
|
|||
config.sops.templates."alloy-basic-auth".path
|
||||
];
|
||||
|
||||
systemd.services.alloy.serviceConfig = {
|
||||
User = "root";
|
||||
};
|
||||
|
||||
|
||||
environment.etc."alloy/config.alloy".text =
|
||||
let
|
||||
|
|
|
@ -97,6 +97,8 @@ in
|
|||
|
||||
limits_config = {
|
||||
retention_period = "90d";
|
||||
ingestion_burst_size_mb = 64;
|
||||
ingestion_rate_mb = 32;
|
||||
};
|
||||
|
||||
storage_config = {
|
||||
|
|
Loading…
Reference in a new issue