ILIAS
release_5-3 Revision v5.3.23-19-g915713cf615
◀ ilDoc Overview
LogParser.php
Go to the documentation of this file.
1
<?php
2
/*
3
* @author Andreas Åkre Solberg <andreas.solberg@uninett.no>
4
* @package SimpleSAMLphp
5
*/
6
class
sspmod_statistics_LogParser
7
{
8
private
$datestart
;
9
private
$datelength
;
10
private
$offset
;
11
19
public
function
__construct
(
$datestart
,
$datelength
,
$offset
)
20
{
21
$this->datestart =
$datestart
;
22
$this->datelength =
$datelength
;
23
$this->offset =
$offset
;
24
}
25
26
public
function
parseEpoch
($line)
27
{
28
$epoch = strtotime(substr($line, 0, $this->datelength));
29
if
($epoch >
time
() + 2678400) {
// 60 * 60 *24 * 31 = 2678400
30
/*
31
* More than a month in the future - probably caused by
32
* the log files missing the year.
33
* We will therefore subtrackt one year.
34
*/
35
$hour = gmdate(
'H'
, $epoch);
36
$minute = gmdate(
'i'
, $epoch);
37
$second = gmdate(
's'
, $epoch);
38
$month = gmdate(
'n'
, $epoch);
39
$day = gmdate(
'j'
, $epoch);
40
$year = gmdate(
'Y'
, $epoch) - 1;
41
$epoch = gmmktime($hour, $minute, $second, $month, $day, $year);
42
}
43
return
$epoch;
44
}
45
46
public
function
parseContent
($line) {
47
$contentstr = substr($line, $this->offset);
48
$content = explode(
' '
, $contentstr);
49
return
$content;
50
}
51
52
// Aug 27 12:54:25 ssp 5 STAT [5416262207] saml20-sp-SSO urn:mace:feide.no:services:no.uninett.wiki-feide sam.feide.no NA
53
//
54
// Oct 30 11:07:14 www1 simplesamlphp-foodle[12677]: 5 STAT [200b4679af] saml20-sp-SLO spinit urn:mace:feide.no:services:no.feide.foodle sam.feide.no
55
56
function
parse15
($str) {
57
$di = date_parse($str);
58
$datestamp = mktime($di[
'hour'
], $di[
'minute'
], $di[
'second'
], $di[
'month'
], $di[
'day'
]);
59
return
$datestamp;
60
}
61
62
function
parse23
($str) {
63
$timestamp
= strtotime($str);
64
return
$timestamp
;
65
}
66
}
sspmod_statistics_LogParser\parseEpoch
parseEpoch($line)
Definition:
LogParser.php:26
sspmod_statistics_LogParser\parse23
parse23($str)
Definition:
LogParser.php:62
sspmod_statistics_LogParser\parse15
parse15($str)
Definition:
LogParser.php:56
sspmod_statistics_LogParser\$datelength
$datelength
Definition:
LogParser.php:9
sspmod_statistics_LogParser\$offset
$offset
Definition:
LogParser.php:10
sspmod_statistics_LogParser\parseContent
parseContent($line)
Definition:
LogParser.php:46
sspmod_statistics_LogParser\$datestart
$datestart
Definition:
LogParser.php:8
$timestamp
foreach($mandatory_scripts as $file) $timestamp
Definition:
buildRTE.php:81
sspmod_statistics_LogParser\__construct
__construct($datestart, $datelength, $offset)
Constructor.
Definition:
LogParser.php:19
time
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
Definition:
40duplicateStyle.php:39
sspmod_statistics_LogParser
Definition:
LogParser.php:6
libs
composer
vendor
simplesamlphp
simplesamlphp
modules
statistics
lib
LogParser.php
Generated on Sat Mar 1 2025 19:01:11 for ILIAS by
1.8.13 (using
Doxyfile
)