Skip to content

Commit

Permalink
Support nginx error logs in promtail scrape configs
Browse files Browse the repository at this point in the history
  • Loading branch information
karandit committed Aug 3, 2023
1 parent 1163122 commit cf5a069
Showing 1 changed file with 30 additions and 2 deletions.
32 changes: 30 additions & 2 deletions modules/wireguard-monitoring/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ in {
clients = [{
url = "http://172.21.0.1:3100/loki/api/v1/push";
}];
scrape_configs = [{
scrape_configs = lib.mkMerge [{
job_name = "journal";
journal = {
max_age = "12h";
Expand Down Expand Up @@ -80,10 +80,38 @@ in {
replacement = "$2";
}
];
}];
}
(lib.mkIf config.services.nginx.enable
{
job_name = "nginx-error-logs";
static_configs = [{
targets = [ "localhost" ];
labels = {
job = "nginx-error-logs";
host = config.networking.hostName;
__path__ = "/var/log/nginx/*error.log";
};
}];
}
)];
};
};

users.users.promtail.extraGroups = lib.mkIf config.services.nginx.enable [ "nginx" ];
# services.promtail.configuration.scrape_configs = [
# {
# job_name = "nginx-error-logs";
# static_configs = [{
# targets = [ "localhost" ];
# labels = {
# job = "nginx-error-logs";
# host = config.networking.hostName;
# __path__ = "/var/log/nginx/*error.log";
# };
# }];
# }
# ];

# wait for wireguard before starting node-exporter
systemd.services.prometheus-node-exporter.after = [ "wireguard-wg0.service" ];
};
Expand Down

0 comments on commit cf5a069

Please sign in to comment.