library logtailminutes
Log extraction utility
objectified/logtailminutes
Log extraction utility
- Wednesday, January 23, 2013
- by objectified
- Repository
- 1 Watchers
- 1 Stars
- 2 Installations
- PHP
- 0 Dependents
- 0 Suggesters
- 0 Forks
- 0 Open issues
- 1 Versions
- 0 % Grown
logtailminutes
Dead simple, tiny utility to extract lines from log files based on time range. Usage:, (*1)
$tail = new LogTailMinutes(
'/path/to/logfile', // log file to extract files from
'd/m/Y', // date format used in the log file, see php.net/date
10, // how many minutes to go back
'now', // time expression to start from, see php.net/strtotime
'/path/to/egrep' // path to egrep binary
);
// optionally, set a filter on the matching results (egrep compatible regex)
$tail->setFilterRegex('HTTP/1.1" (4|5)[0-9]{2}');
// get matched lines
$lines = $tail->getLines();