. // grep logs for a particular string require_once("../inc/util_ops.inc"); $log_dir = parse_config(get_config(), ""); if (!$log_dir) { exit("Error: couldn't get log_dir from config file."); } if( isset($_GET["f"]) ){ $f = $_GET["f"]; $f = escapeshellcmd($f); } else { $f = ""; } if( isset($_GET["s"]) ){ $s = $_GET["s"]; $s = escapeshellcmd($s); } else { $s = ""; } if( isset($_GET["l"]) ){ $l = (int)$_GET["l"]; } else { $l = 0; } if ($s) { admin_page_head("Grep logs for \"$s\""); } else { admin_page_head("Show logs"); } echo "
"; echo " Regexp: "; echo " Files: "; echo " Lines: (positive for head, negative for tail)"; echo "
"; echo 'Hint: Example greps: "RESULT#106876", "26fe99aa_25636_00119.wu_1", "WU#8152", "too many errors", "2003-07-17", "CRITICAL"
'; if (strlen($f)) { $f = "../log*/". $f; } else { $f = "../log*/*.log"; } if ($s) { passthru("cd $log_dir && ../bin/grep_logs -html -l $l '$s' $f 2>&1"); } admin_page_tail(); ?>