<?php
/**
* AbyssWS Log Splitter: v0.1b3
* Created by: Josh (TRUSTAbyss)
*
* Provided by: trustabyss.com and
* sourceforge.net
*
* AbyssWS Log Splitter
* Copyright (C) 2007 Joshua H.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* License Information:
* http://www.gnu.org/licenses/gpl.txt
*/
// Please provide the full path to your log file, using forward
// slashes in the path. Default is given.
$log_file = "C:/Program Files/Abyss Web Server/log/access.log";
// Please provide the Output Directory where your seperated log files
// will be stored. Default is given.
$output_dir = "C:/Program Files/Abyss Web Server/log";
// Warning! Don't Edit Anthing Else!
// No more configuration is needed. Enjoy!
print "Reading log file. Please wait...\n";
$fp =
fopen($log_file,
"r");
$buffer =
fgets($fp,
1024);
if (preg_match("/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s.+\s.+\s\[[0-9]+\/([a-zA-Z]+)\/([0-9]+)/",
$buffer,
$match)) {
if (!
in_array("$match[1]-$match[2]",
$date_array)) {
$date_array[] = "$match[1]-$match[2]";
}
}
}
print "Your log file is being seperated. Please wait...\n";
foreach ($date_array as $month_year) {
$fp =
fopen($log_file,
"r");
$nfp =
fopen("$output_dir/$month_year-$base_file",
"a");
$buffer =
fgets($fp,
1024);
$date_part =
explode("-",
$month_year);
if (preg_match("/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s.+\s.+\s\[[0-9]+\/$date_part[0]\/$date_part[1]/",
$buffer,
$match)) {
}
}
}
$uptime = $stop - $start;
$day =
floor($uptime/
86400);
$hour =
floor(($uptime%
86400)/
3600);
$min =
floor(($uptime%
3600)/
60);
$sec = ($uptime % 60);
$time = "$day Day(s), $hour Hour(s), $min Min(s), $sec Sec(s)";
print "\n\nFinished!\n\nTotal Time: " .
$time .
"\n\n";
?>