ma download.binaergewitter.de: logrotate nginx logs like a babarian

This commit is contained in:
makefu 2018-12-31 10:17:15 +01:00
parent 1e7e39576c
commit 05916b9a22
No known key found for this signature in database
GPG Key ID: 36F7711F3FC0F225

View File

@ -3,6 +3,8 @@
with import <stockholm/lib>; with import <stockholm/lib>;
let let
ident = (builtins.readFile ./auphonic.pub); ident = (builtins.readFile ./auphonic.pub);
bgtaccess = "/var/spool/nginx/logs/binaergewitter.access.log";
bgterror = "/var/spool/nginx/logs/binaergewitter.error.log";
in { in {
services.openssh = { services.openssh = {
allowSFTP = true; allowSFTP = true;
@ -21,6 +23,19 @@ in {
useDefaultShell = true; useDefaultShell = true;
openssh.authorizedKeys.keys = [ ident config.krebs.users.makefu.pubkey ]; openssh.authorizedKeys.keys = [ ident config.krebs.users.makefu.pubkey ];
}; };
services.logrotate = {
enable = true;
config = ''
${bgtaccess} ${bgterror} {
rotate 5
weekly
create 600 nginx nginx
postrotate
${pkgs.systemd}/bin/systemctl reload nginx
endscript
}
'';
};
services.nginx = { services.nginx = {
enable = lib.mkDefault true; enable = lib.mkDefault true;
recommendedGzipSettings = true; recommendedGzipSettings = true;
@ -29,10 +44,21 @@ in {
serverAliases = [ "dl2.binaergewitter.de" ]; serverAliases = [ "dl2.binaergewitter.de" ];
root = "/var/www/binaergewitter"; root = "/var/www/binaergewitter";
extraConfig = '' extraConfig = ''
access_log /var/spool/nginx/logs/binaergewitter.access.log combined; access_log ${bgtaccess} combined;
error_log /var/spool/nginx/logs/binaergewitter.error.log error; error_log ${bgterror} error;
autoindex on; autoindex on;
''; '';
}; };
}; };
environment.etc."netdata/python.d/web_log.conf".text = ''
nginx_log3:
name: 'nginx'
path: '/var/spool/nginx/logs/access.log'
nginx_log4:
name: 'bgt'
path: '${bgtaccess}'
'';
users.users.netdata.extraGroups = [ "nginx" ];
} }