monitoring

This commit is contained in:
41666 2024-02-11 02:19:06 -05:00
parent f015679b0c
commit 81356205a0

View file

@ -1,22 +1,24 @@
{ config, ... }: {
{ config, ... }: let
format = "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\"";
in {
services.prometheus.exporters.nginxlog = {
enable = true;
port = 14201;
user = config.services.nginx.user;
group = config.services.nginx.group;
settings = {
namespaces = [
{
name = "nginx";
source.files = ["/var/log/nginx/access.log"];
format = "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\"";
}
];
namespaces = [{
inherit format;
name = "nginx";
source.files = ["/var/log/nginx/access.log"];
}];
};
};
services.nginx.commonHttpConfig = ''
access_log /var/log/nginx/access.log;
log_format combined ${format};
'';
networking.firewall.allowedTCPPorts = [ 14201 ];