Login   Register  
PHP Classes
elePHPant
Icontem

File: example.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of murat  >  My Error Log Parsing in PHP  >  example.php  >  Download  
File: example.php
Role: Example script
Content type: text/plain
Description: example using file
Class: My Error Log Parsing in PHP
Parse Apache or MySQL error log files
Author: By
Last change:
Date: 2007-11-17 07:14
Size: 2,767 bytes
 

Contents

Class file image Download
<?php
    
##################################################################
    ##                                                                ##
    ##            Class Name    : errorLogParser                        ##
    ##            Author        : Murat Küçükosman                        ##
    ##            Mail        : murat@kucukosman.net                    ##
    ##            Web            : http://www.morad.info/                ##
    ##                                                                ##
    ##################################################################
    ##                                                                ##
    ##        $eLog = new errorLogParser();                            ##
    ##        $eLog->type="mysql";                                    ##
    ##        $eLog->file = "mysql_err/err.log";                        ##
    ##        $eLog->tumSatirlar = $eLog->readLogFile();                ##
    ##                                                                ##
    ##                                                                ##
    ##################################################################
include("class.errorLogger.php");

$eLog = new errorLogParser();
$eLog->type="mysql";
$eLog->file "mysql_err/err.log";
$eLog->readLogFile();

echo 
"<h2>MySQL logparser</h2>"
$eLog->ne "Note";
echo 
"<a href=\"?p=Note\">Notice:</a> ".number_format($eLog->say());

echo 
"<br><br>";

$eLog->ne "ERROR";
echo 
"<a href=\"?p=ERROR\">error:</a> ".number_format($eLog->say());

echo 
"<br><br>";

$eLog->ne "Warning";
echo 
"<a href=\"?p=Warning\">Warning:</a> ".number_format($eLog->say());
echo 
"<br><br>";

if (!empty(
$_GET['p'])) {
    
$eLog->ne trim($_GET['p']);
    
$dd $eLog->yazBildir();
    foreach (
$dd AS $nok) {
        list(
$yil,$saat,$saat1) = explode(" ",$nok['Zaman']);
        if (
$eLog->type=="mysql") {
        echo 
$yil "<b>".$eLog->f_timestamp_convert("20".$yil."000000",1)." ".$saat.$saat1." :</b> ";
        } else {
            echo 
"<b>".$nok['Zaman']." :</b> ";
        }
        echo 
$nok['Sonra']."<br>";
    }
}
echo 
"<hr>";

$aLog = new errorLogParser();
$aLog->type="httpd";
$aLog->file "http_err/error.log";
$aLog->readLogFile();

echo 
"<h2>httpd logparser</h2>"
$aLog->ne "notice";
echo 
"<a href=\"?p2=notice\">Notice:</a> ".number_format($aLog->say());

echo 
"<br><br>";

$aLog->ne "error";
echo 
"<a href=\"?p2=error\">error:</a> ".number_format($aLog->say());

echo 
"<br><br>";

$aLog->ne "FATAL";
echo 
"<a href=\"?p2=FATAL\">FATAL:</a> ".number_format($aLog->say());
echo 
"<br><br>";

if (!empty(
$_GET['p2'])) {
    
$aLog->ne trim($_GET['p2']);
    
$dd $aLog->yazBildir();
    foreach (
$dd AS $nok) {
        list(
$yil,$saat,$saat1) = explode(" ",$nok['Zaman']);
        if (
$aLog->type=="mysql") {
        echo 
$yil "<b>".$aLog->timestampC("20".$yil."000000",1)." ".$saat.$saat1." :</b> ";
        } else {
            echo 
"<b>".$nok['Zaman']." :</b> ";
        }
        echo 
$nok['Sonra']."<br>";
    }
}
?>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style>
BODY {
font-family: arial;
font-size:10px;
}
</style>
<br>
<br>
<br>
<br>
<br>
<span style="font-size:9px;font-family:arial;">©2007 murat küçükosman</span>