some improvements

This commit is contained in:
Ingolf Wagner 2024-05-16 13:10:48 +02:00
parent a5234a2a84
commit 9160b34178
No known key found for this signature in database
GPG key ID: 76BF5F1928B9618B
3 changed files with 21 additions and 17 deletions

View file

@ -10,7 +10,7 @@ with types;
config = mkMerge [
(mkIf config.components.monitor.exporters.zfs.enable {
services.telegraf.extraConfig.inputs.zfs = {};
services.telegraf.extraConfig.inputs.zfs = { };
services.prometheus.exporters.zfs.enable = true;
services.opentelemetry-collector.settings = {

View file

@ -52,10 +52,17 @@ in
};
pipeline_stages = [
{
# journalctl -o json | jq and you'll see these
json.expressions = {
transport = "_TRANSPORT";
unit = "_SYSTEMD_UNIT";
msg = "MESSAGE";
priority = "PRIORITY";
facility = "SYSLOG_FACILITY";
boot_id = "_BOOT_ID";
instance = "_HOSTNAME";
# coredump
coredump_cgroup = "COREDUMP_CGROUP";
coredump_exe = "COREDUMP_EXE";
coredump_cmdline = "COREDUMP_CMDLINE";
@ -85,12 +92,6 @@ in
output.source = "msg";
}
];
relabel_configs = [
{
source_labels = [ "__journal__hostname" ];
target_label = "instance";
}
];
}
];
};

View file

@ -1,10 +1,6 @@
{ config, pkgs, ... }:
{
services.opentelemetry-collector.settings = {
exporters.loki = {
endpoint = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push";
@ -20,14 +16,21 @@
{
action = "insert";
key = "loki.attribute.labels";
value = "job, unit";
value = "job, unit, boot_id, instance, facility, priority";
}
];
resource.attributes = [
{
action = "insert";
key = "loki.resource.labels";
value = "host.name";
}
{
action = "insert";
key = "loki.format";
value = "raw";
}
];
resource.attributes = [{
action = "insert";
key = "loki.resource.labels";
value = "host.name";
}];
};
service.pipelines.logs.exporters = [ "loki" ];
service.pipelines.logs.processors = [ "resource" "attributes" ];