diff --git a/modules/statistics/bin/logcleaner.php b/modules/statistics/bin/logcleaner.php index 9111d92cc1bb59bf38cb7021262824cc13339ccf..ffa1ecded1eae116f963e2d63daae25da6464149 100755 --- a/modules/statistics/bin/logcleaner.php +++ b/modules/statistics/bin/logcleaner.php @@ -17,6 +17,7 @@ $progName = array_shift($argv); $debug = FALSE; $dryrun = FALSE; $output = '/tmp/simplesamlphp-new.log'; +$infile = NULL; foreach($argv as $a) { if(strlen($a) === 0) continue; @@ -45,6 +46,9 @@ foreach($argv as $a) { case '--dry-run': $dryrun = TRUE; break; + case '--infile': + $infile = $v; + break; case '--outfile': $output = $v; break; @@ -55,7 +59,7 @@ foreach($argv as $a) { } } -$cleaner = new sspmod_statistics_LogCleaner(); +$cleaner = new sspmod_statistics_LogCleaner($infile); $cleaner->dumpConfig(); $todelete = $cleaner->clean($debug); @@ -80,6 +84,7 @@ The script deletes log lines related to sessions that produce more than 200 line Options: -d, --debug Used when configuring the log file syntax. See doc. --dry-run Aggregate but do not store the results. + --infile File input. --outfile File to output the results. '); diff --git a/modules/statistics/lib/LogCleaner.php b/modules/statistics/lib/LogCleaner.php index fe9250f9d198e508f833953f72fef9b72eedaaf0..5d086ba7500a351a9babf43083e2f7c204dd6845 100644 --- a/modules/statistics/lib/LogCleaner.php +++ b/modules/statistics/lib/LogCleaner.php @@ -15,7 +15,7 @@ class sspmod_statistics_LogCleaner { /** * Constructor */ - public function __construct() { + public function __construct($inputfile = NULL) { $this->statconfig = SimpleSAML_Configuration::getConfig('module_statistics.php'); @@ -23,6 +23,8 @@ class sspmod_statistics_LogCleaner { $this->inputfile = $this->statconfig->getValue('inputfile'); $this->statrules = $this->statconfig->getValue('statrules'); $this->offset = $this->statconfig->getValue('offset', 0); + + if (isset($inputfile)) $this->inputfile = $inputfile; } public function dumpConfig() {