2003-07-02 22:33:18 +00:00
|
|
|
<?php {
|
|
|
|
|
|
|
|
// $Id$
|
|
|
|
|
|
|
|
// grep logs for a particular string
|
|
|
|
|
2003-07-21 21:38:54 +00:00
|
|
|
require_once("util_ops.inc");
|
2003-07-02 22:33:18 +00:00
|
|
|
|
|
|
|
$log_dir = parse_config("<log_dir>");
|
|
|
|
if (!$log_dir) {
|
|
|
|
exit("Error: couldn't get log_dir from config file.");
|
|
|
|
}
|
|
|
|
|
2003-07-15 21:37:04 +00:00
|
|
|
$f = $_GET["f"];
|
|
|
|
$s = $_GET["s"];
|
|
|
|
|
|
|
|
if (!$f || !preg_match("/^ *([a-z_*]+[.](log|out) *)+$/", $f)) {
|
2003-07-15 21:30:36 +00:00
|
|
|
$f = '*.log';
|
2003-07-02 22:33:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if ($s) {
|
|
|
|
page_head("Grep logs for \"$s\"");
|
|
|
|
} else {
|
|
|
|
page_head("Show logs");
|
|
|
|
}
|
|
|
|
|
|
|
|
echo "<form action=show_log.php>";
|
2003-07-02 22:52:53 +00:00
|
|
|
echo " Regexp: <input name=s value='$s'>";
|
2003-07-02 22:33:18 +00:00
|
|
|
echo " Files: <input name=f value='$f'>";
|
|
|
|
echo " <input type=submit value=Grep></form>";
|
|
|
|
|
2003-07-15 21:28:42 +00:00
|
|
|
echo 'Hint: Example greps: "RESULT#106876", "26fe99aa_25636_00119.wu_1", "WU#8152", "too many errors", "2003-07-17", "CRITICAL" <br>';
|
2003-07-02 22:52:53 +00:00
|
|
|
|
2003-07-15 21:30:05 +00:00
|
|
|
passthru("cd $log_dir && ../bin/grep_logs -html '$s' $f 2>&1");
|
2003-07-02 22:33:18 +00:00
|
|
|
|
|
|
|
page_tail();
|
|
|
|
} ?>
|