run goaccess periodically

This commit is contained in:
Joeri Exelmans 2025-11-06 00:06:47 +01:00
parent 81bb571537
commit cb2edc9aeb
5 changed files with 25 additions and 6 deletions

BIN
deemz.org/GeoLite2-ASN.mmdb Normal file

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 59 MiB

Binary file not shown.

View file

@ -83,6 +83,25 @@ let secrets = import ../secrets.nix; in
};
users.groups.icomidal = {};
# Run goaccess script hourly
systemd.timers.goaccess = {
wantedBy = [ "timers.target" ];
timerConfig = {
OnCalendar = "hourly";
Persistent = true;
Unit = "goaccess.service";
};
};
systemd.services.goaccess = {
script = "${pkgs.gzip}/bin/zcat /var/log/nginx/access.log.*.gz | ${pkgs.goaccess}/bin/goaccess -a -o /var/log/nginx/goaccess.html --log-format=COMBINED --geoip-database=${./GeoLite2-City.mmdb} --geoip-database=${./GeoLite2-Country.mmdb} --geoip-database=${./GeoLite2-ASN.mmdb} /var/log/nginx/access.log /var/log/nginx/access.log.1 -";
serviceConfig = {
Type = "oneshot";
User = "nginx";
Nice = 19; # low priority
IOSchedulingClass = "idle";
};
};
services.xserver.xkb.layout = "us";
services.xserver.xkb.options = "eurosign:e";

12
flake.lock generated
View file

@ -22,11 +22,11 @@
},
"nixpkgs-stable": {
"locked": {
"lastModified": 1758589230,
"narHash": "sha256-zMTCFGe8aVGTEr2RqUi/QzC1nOIQ0N1HRsbqB4f646k=",
"lastModified": 1761468971,
"narHash": "sha256-vY2OLVg5ZTobdroQKQQSipSIkHlxOTrIF1fsMzPh8w8=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "d1d883129b193f0b495d75c148c2c3a7d95789a0",
"rev": "78e34d1667d32d8a0ffc3eba4591ff256e80576e",
"type": "github"
},
"original": {
@ -38,11 +38,11 @@
},
"nixpkgs-unstable": {
"locked": {
"lastModified": 1758427187,
"narHash": "sha256-pHpxZ/IyCwoTQPtFIAG2QaxuSm8jWzrzBGjwQZIttJc=",
"lastModified": 1761373498,
"narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=",
"owner": "nixos",
"repo": "nixpkgs",
"rev": "554be6495561ff07b6c724047bdd7e0716aa7b46",
"rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce",
"type": "github"
},
"original": {