some improvements

This commit is contained in:
Ingolf Wagner 2024-05-16 13:10:48 +02:00
parent a5234a2a84
commit 9160b34178
Signed by: palo
GPG key ID: 76BF5F1928B9618B
3 changed files with 21 additions and 17 deletions

View file

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

View file

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

View file

@ -1,10 +1,6 @@
{ config, pkgs, ... }: { config, pkgs, ... }:
{ {
services.opentelemetry-collector.settings = { services.opentelemetry-collector.settings = {
exporters.loki = { exporters.loki = {
endpoint = "http://127.0.0.1:${toString config.services.loki.configuration.server.http_listen_port}/loki/api/v1/push"; 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"; action = "insert";
key = "loki.attribute.labels"; 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.exporters = [ "loki" ];
service.pipelines.logs.processors = [ "resource" "attributes" ]; service.pipelines.logs.processors = [ "resource" "attributes" ];