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 = {
|
||||
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 ];
|
||||
|
|
Loading…
Add table
Reference in a new issue