monitoring
This commit is contained in:
parent
f015679b0c
commit
81356205a0
1 changed files with 10 additions and 8 deletions
|
@ -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 = {
|
services.prometheus.exporters.nginxlog = {
|
||||||
enable = true;
|
enable = true;
|
||||||
port = 14201;
|
port = 14201;
|
||||||
user = config.services.nginx.user;
|
user = config.services.nginx.user;
|
||||||
group = config.services.nginx.group;
|
group = config.services.nginx.group;
|
||||||
settings = {
|
settings = {
|
||||||
namespaces = [
|
namespaces = [{
|
||||||
{
|
inherit format;
|
||||||
name = "nginx";
|
|
||||||
source.files = ["/var/log/nginx/access.log"];
|
name = "nginx";
|
||||||
format = "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\"";
|
source.files = ["/var/log/nginx/access.log"];
|
||||||
}
|
}];
|
||||||
];
|
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
services.nginx.commonHttpConfig = ''
|
services.nginx.commonHttpConfig = ''
|
||||||
access_log /var/log/nginx/access.log;
|
access_log /var/log/nginx/access.log;
|
||||||
|
log_format combined ${format};
|
||||||
'';
|
'';
|
||||||
|
|
||||||
networking.firewall.allowedTCPPorts = [ 14201 ];
|
networking.firewall.allowedTCPPorts = [ 14201 ];
|
||||||
|
|
Loading…
Add table
Reference in a new issue