add persistent db storage to goaccess-traffictool to have more data in the output index.html; add security questions when deleting certificates as we do for apikeys and dns-entries

Signed-off-by: Michael Kaufmann <d00p@froxlor.org>
This commit is contained in:
Michael Kaufmann
2022-11-06 10:11:40 +01:00
parent 8eedf87ac3
commit 78945768ec
7 changed files with 173 additions and 153 deletions

View File

@@ -645,10 +645,20 @@ class TrafficCron extends FroxlorCron
@unlink($outputdir . '.tmp.json');
}
// goaccess <1.4
$keep_params = '--keep-db-files --load-from-disk';
$res = FileDir::safe_exec('goaccess --version');
$ver_str = array_shift($res);
$cGoVer = substr($ver_str, strrpos($ver_str, " ") + 1, -1);
if (version_compare($cGoVer, '1.4', '>=')) {
// at least 1.4
$keep_params = '--persist --restore';
}
$format = Settings::Get('system.logfiles_type') == '2' ? 'VCOMBINED' : 'COMBINED';
$monthyear = $monthyear_arr['month'] . '/' . $monthyear_arr['year'];
$return_value = false;
FileDir::safe_exec("grep '" . $monthyear . "' " . escapeshellarg($logfile) . " | goaccess -o " . escapeshellarg($outputdir . '.tmp.json') . " -o " . escapeshellarg($outputdir . 'index.html') . " --html-report-title=" . escapeshellarg($caption) . " --log-format=" . $format . " - ", $return_value, ['|']);
FileDir::safe_exec("grep '" . $monthyear . "' " . escapeshellarg($logfile) . " | goaccess " . $keep_params . " --db-path=" . escapeshellarg($outputdir) . " -o " . escapeshellarg($outputdir . '.tmp.json') . " -o " . escapeshellarg($outputdir . 'index.html') . " --html-report-title=" . escapeshellarg($caption) . " --log-format=" . $format . " - ", $return_value, ['|']);
if (file_exists($outputdir . '.tmp.json')) {
// need jq here because of potentially LARGE json files