X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=modules%2Fwebapps%2Fwebstats%2Fdefault.nix;h=fe5f068d410345e1f84a20e8c0d65474989260ec;hb=5400b9b6f65451d41a9106fae6fc00f97d83f4ef;hp=feff951c9eeb324b81044b0bc094e5982d7f3e82;hpb=2a5cde8d47d5c887067176555596cf8feb5c4d8b;p=perso%2FImmae%2FConfig%2FNix.git diff --git a/modules/webapps/webstats/default.nix b/modules/webapps/webstats/default.nix index feff951..fe5f068 100644 --- a/modules/webapps/webstats/default.nix +++ b/modules/webapps/webstats/default.nix @@ -1,4 +1,4 @@ -{ lib, pkgs, config, mylibs, ... }: +{ lib, pkgs, config, ... }: let name = "goaccess"; cfg = config.services.webstats; @@ -23,7 +23,7 @@ in { ''; }; name = lib.mkOption { - type = lib.types.string; + type = lib.types.str; description = '' Domain name. Corresponds to the Apache file name and the folder name in which the state will be saved. @@ -37,6 +37,9 @@ in { }; config = lib.mkIf (builtins.length cfg.sites > 0) { + services.duplyBackup.profiles.goaccess = { + rootDir = cfg.dataDir; + }; users.users.root.packages = [ pkgs.goaccess ]; @@ -59,8 +62,8 @@ in { trap "rm -f $TMPFILE" EXIT mkdir -p ${cfg.dataDir}/${domain} - cat /var/log/httpd/access_log-${domain} | sed -n "/\\[$date_regex/ p" > $TMPFILE - for i in /var/log/httpd/access_log-${domain}*.gz; do + cat /var/log/httpd/access-${domain}.log | sed -n "/\\[$date_regex/ p" > $TMPFILE + for i in /var/log/httpd/access-${domain}*.gz; do zcat "$i" | sed -n "/\\[$date_regex/ p" >> $TMPFILE done ${pkgs.goaccess}/bin/goaccess $TMPFILE --no-progress -o ${cfg.dataDir}/${domain}/index.html -p ${config}