WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDES  |  PHP CLASSES  |  CODE SEARCH  |  ARTICLES SEARCH  |  PHP FORUMS  |  PHP MANUAL  |  PHP FUNCTIONS LIST  |  WEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Submit Your Code
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
WeberDev's Monthly code contest PHP Code Contest
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Index
PHP Web Logs (BLogs)
Web Development Resources
Web Development Content
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
Submit Site
Forex Trading Online forex trading platform

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : PHP Based Apache + Mysql Error Log Parser
Categories : PHP, PHP Classes, Apache, MySQL, Log Files Click here to Update Your Picture
Murat Kucukosman
Date : Nov 17th 2007
Grade : 3 of 5 (graded 3 times)
Viewed : 1165
File : 4721.zip
Images : No Images for this code example.
Search : More code by Murat Kucukosman
Action : Grade This Code Example
Tools : My Examples List

  Submit your own code examples 
 

This class is an example for an Apache and Mysql error log parser (see attached file for the classes).

Usage Example
<?php
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>



Scan Apache access log files and report possible worms attack
Categories : PHP, PHP Classes, Security, Apache, Log Files
PHP4 MYSQL Authentication Script with cookie. Short & Sweet
Categories : Authentication, Apache, Cookies, PHP, MySQL
usercounter class
Categories : PHP, PHP Classes, Databases, MySQL, Environment Variables
MySQL Handler
Categories : PHP, Databases, MySQL, Classes and Objects, PHP Classes
PostGreSQL and MySQL 2 in 1 db Manager
Categories : PHP, PHP Classes, Databases, PostgreSQL, MySQL
MySQL Class to ease Database connectivity
Categories : MySQL, PHP Classes, Databases, PHP
Simple Mini Poll class library (SimPoll)
Categories : PHP, PHP Classes, Databases, MySQL, Complete Programs
Online Automatic Class Generator for MySQL Tables
Categories : PHP, PHP Classes, Classes and Objects, Databases, MySQL
Specify your connection settings and create a link to a MySQL database.
Categories : PHP, PHP Classes, Databases, MySQL, Beginner Guides
Simple database class
Categories : PHP, PHP Classes, MySQL, Databases
Simple usersOnline class - keep track of how many users are online on your site
Categories : PHP, PHP Classes, Databases, MySQL
Setting up InnoDB on MySQL and using Transactions Begin, Commit, Rollback in PHP.
Categories : PHP Classes, Databases, PHP, MySQL, InnoDB
Ajax PHP Tree (Left and Right) with MySQL
Categories : PHP, Databases, MySQL, AJAX, PHP Classes
YellowPages Content Grabber (PHP5 +)
Categories : PHP, PHP Classes, Regexps, Databases, MySQL
Easy windows installation kit for win 9* PHP4 MySQL Apache phpMyAdmin
Categories : Installation, PHP, MySQL, Apache, Web Servers