]> git.immae.eu Git - perso/Immae/Config/Nix.git/blobdiff - modules/webapps/webstats/default.nix
Upgrade goaccess and adjust parsing
[perso/Immae/Config/Nix.git] / modules / webapps / webstats / default.nix
index e822645c605e162ee14ea3e4638fa327f84ffbb8..7a2774112f545a8f7b4f863c24b7f12dbee849f6 100644 (file)
@@ -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.
@@ -57,15 +57,14 @@ in {
             #!${pkgs.stdenv.shell}
             set -e
             shopt -s nullglob
-            date_regex=$(LC_ALL=C date -d yesterday +'%d\/%b\/%Y')
             TMPFILE=$(mktemp)
             trap "rm -f $TMPFILE" EXIT
 
             mkdir -p ${cfg.dataDir}/${domain}
-            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
+              zcat "$i" >> $TMPFILE
             done
+            cat /var/log/httpd/access-${domain}.log > $TMPFILE
             ${pkgs.goaccess}/bin/goaccess $TMPFILE --no-progress -o ${cfg.dataDir}/${domain}/index.html -p ${config}
             '';
           in "${d}/bin/stats-${domain}";