/**
  * Test for parseLine() in case of invalid line.
  *
  * @param string $format
  * @param string $logLine
  *
  * @dataProvider getTestParseLineNoMatchesData()
  * @expectedException \MVar\Apache2LogParser\Exception\NoMatchesException
  * @expectedExceptionMessage line does not match
  */
 public function testParseLineNoMatches($format, $logLine)
 {
     $parser = new AccessLogParser($format);
     $parser->parseLine($logLine);
 }
Ejemplo n.º 2
0
 */
$relpa = ($relpa0 = preg_replace("/[\\/]+/", "/", $_SERVER['DOCUMENT_ROOT'] . '/')) ? $relpa0 : '';
ob_start();
$a_inc = array('inc/regional.inc', 'inc/adminauth.inc', 'lib/swamper.class.php');
foreach ($a_inc as $v) {
    require_once $relpa . $v;
}
class AccessLogParser extends Swamper
{
    function __construct()
    {
        parent::__construct();
    }
}
if (!isset($AccessLogParser) || empty($AccessLogParser)) {
    $AccessLogParser = new AccessLogParser();
}
$access_log = '';
switch (str_replace('www.', '', $_SERVER['HTTP_HOST'])) {
    case 'localhost':
        $access_log = 'D:/server/logs/access.log';
        break;
    case 'shimansky.biz':
        $access_log = '/usr/home/23954/shimansky.biz/log/' . date("Y-m-d") . '.access.log';
        break;
}
if (!file_exists($access_log)) {
    die('<p>Please specify log file path once again.<br />in /etc/httpd/conf/httpd.conf uncomment and write access_log=/etc/httpd/error_log<br /><br />su<br />cd /etc/httpd<br />touch error_log<br />httpd -k stop<br />httpd</p>');
}
if (!empty($_REQUEST['clear'])) {
    $AccessLogParser->write_file($access_log, '', "w+");