Definition at line 6 of file LogCleaner.php.
◆ __construct()
sspmod_statistics_LogCleaner::__construct |
( |
|
$inputfile = null | ) |
|
Constructor.
Definition at line 17 of file LogCleaner.php.
References $inputfile, and SimpleSAML_Configuration\getConfig().
21 $this->statdir = $this->statconfig->getValue(
'statdir');
22 $this->inputfile = $this->statconfig->getValue(
'inputfile');
23 $this->statrules = $this->statconfig->getValue(
'statrules');
24 $this->offset = $this->statconfig->getValue(
'offset', 0);
static getConfig($filename='config.php', $configSet='simplesaml')
Load a configuration file from a configuration set.
◆ clean()
sspmod_statistics_LogCleaner::clean |
( |
|
$debug = false | ) |
|
Definition at line 46 of file LogCleaner.php.
References Sabre\VObject\$debug, $i, $sc, $todelete, and exit.
48 if (!is_dir($this->statdir)) {
49 throw new Exception(
'Statistics module: output dir do not exists [' . $this->statdir .
']');
52 if (!file_exists($this->inputfile)) {
53 throw new Exception(
'Statistics module: input file do not exists [' . $this->inputfile .
']');
56 $file =
fopen($this->inputfile,
'r');
59 $this->statconfig->getValue(
'datestart', 0), $this->statconfig->getValue(
'datelength', 15), $this->statconfig->getValue(
'offsetspan', 44)
62 $sessioncounter = array();
66 while (!feof($file)) {
67 $logline = fgets($file, 4096);
70 if (!preg_match(
'/STAT/', $logline)) {
76 $epoch = $logparser->parseEpoch($logline);
77 $content = $logparser->parseContent($logline);
79 if ((
$i % 10000) == 0) {
80 echo(
"Read line " .
$i .
"\n");
83 $trackid = $content[4];
85 if (!isset($sessioncounter[$trackid])) {
86 $sessioncounter[$trackid] = 0;
88 $sessioncounter[$trackid]++;
91 echo(
"----------------------------------------\n");
92 echo(
'Log line: ' . $logline .
"\n");
93 echo(
'Date parse [' . substr($logline, 0, $this->statconfig->getValue(
'datelength', 15)) .
'] to [' . date(DATE_RFC822, $epoch) .
']' .
"\n");
94 echo htmlentities(print_r($content,
true));
101 $histogram = array();
102 foreach ($sessioncounter as $trackid =>
$sc) {
103 if (!isset($histogram[
$sc])) {
111 foreach ($sessioncounter as $trackid =>
$sc) {
◆ dumpConfig()
sspmod_statistics_LogCleaner::dumpConfig |
( |
| ) |
|
Definition at line 34 of file LogCleaner.php.
36 echo 'Statistics directory : ' . $this->statdir .
"\n";
37 echo 'Input file : ' . $this->inputfile .
"\n";
38 echo 'Offset : ' . $this->offset .
"\n";
◆ store()
sspmod_statistics_LogCleaner::store |
( |
|
$todelete, |
|
|
|
$outputfile |
|
) |
| |
Definition at line 126 of file LogCleaner.php.
References $i, $todelete, and sspmod_statistics_LogParser\parseContent().
128 echo "Preparing to delete [" .count(
$todelete) .
"] trackids\n";
130 if (!is_dir($this->statdir)) {
131 throw new Exception(
'Statistics module: output dir do not exists [' . $this->statdir .
']');
134 if (!file_exists($this->inputfile)) {
135 throw new Exception(
'Statistics module: input file do not exists [' . $this->inputfile .
']');
138 $file =
fopen($this->inputfile,
'r');
141 if (file_exists($outputfile)) {
145 $outfile =
fopen($outputfile,
'x');
148 $this->statconfig->getValue(
'datestart', 0), $this->statconfig->getValue(
'datelength', 15), $this->statconfig->getValue(
'offsetspan', 44)
153 while (!feof($file)) {
154 $logline = fgets($file, 4096);
157 if (!preg_match(
'/STAT/', $logline)) {
164 if (($i % 10000) == 0) {
165 echo(
"Read line " . $i .
"\n");
168 $trackid = $content[4];
169 if (in_array($trackid,
$todelete,
true)) {
173 fputs($outfile, $logline);
◆ $inputfile
sspmod_statistics_LogCleaner::$inputfile |
|
private |
◆ $offset
sspmod_statistics_LogCleaner::$offset |
|
private |
◆ $statconfig
sspmod_statistics_LogCleaner::$statconfig |
|
private |
◆ $statdir
sspmod_statistics_LogCleaner::$statdir |
|
private |
◆ $statrules
sspmod_statistics_LogCleaner::$statrules |
|
private |
The documentation for this class was generated from the following file:
- libs/composer/vendor/simplesamlphp/simplesamlphp/modules/statistics/lib/LogCleaner.php