Skip to content

Commit 6c66e68

Browse files
[Fix] GoAccess ignore historical compressed files (#1142)
1 parent 89f5266 commit 6c66e68

2 files changed

Lines changed: 13 additions & 2 deletions

File tree

app/Services/LogAnalysis/GoAccess/GoAccess.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class GoAccess extends AbstractService
2121

2222
public const CRON_FREQUENCY = '0 * * * *';
2323

24-
public const SCRIPT_VERSION = 1;
24+
public const SCRIPT_VERSION = 2;
2525

2626
public const CONF_VERSION = 1;
2727

resources/views/ssh/services/log_analysis/goaccess/bin/process.blade.php

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,19 @@
6161
fi
6262
else
6363
# Normal path: direct-file incremental (GoAccess tracks inode/offset).
64+
# Feed only uncompressed logs — GoAccess reads rotated *.gz files as
65+
# binary and aborts the run. Compressed rotations were already ingested
66+
# by earlier runs, and the boundary window above re-reads them via
67+
# `zcat -f` when crossing months.
68+
local files=() f
6469
# shellcheck disable=SC2086
65-
goaccess $LOG_GLOB --log-format="$LOG_FORMAT" --persist --restore --db-path="$db" -o "$out" --date-spec=date --no-progress
70+
for f in $LOG_GLOB; do
71+
[ -e "$f" ] || continue
72+
case "$f" in *.gz) continue ;; esac
73+
files+=("$f")
74+
done
75+
[ "${#files[@]}" -gt 0 ] || return 0
76+
goaccess "${files[@]}" --log-format="$LOG_FORMAT" --persist --restore --db-path="$db" -o "$out" --date-spec=date --no-progress
6677
fi
6778
}
6879

0 commit comments

Comments
 (0)