ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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  */
7 {
8  private $datestart;
9  private $datelength;
10  private $offset;
11 
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 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
__construct($datestart, $datelength, $offset)
Constructor.
Definition: LogParser.php:19
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.