From 11f3921d48ca48a9e9da84a4822583a3ca34df43 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Wed, 23 Aug 2017 16:22:47 +0200 Subject: provide command line for checking past errs --- it.class | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index 47ce722..2407b5b 100644 --- a/it.class +++ b/it.class @@ -240,7 +240,7 @@ static function error($p = array()) if ($sendmail) # we're mailing: send maximum info { - $p['title'] = "Alert: " . it::replace(['\.[^:]*' => "", '(alert|server): ' => "", "^: " => ""], $GLOBALS['ULTRASITE'] . ": ") . $p['title'] . " (via " . getenv('HOSTNAME') . ")"; + $p['title'] = it::replace(['\.[^:]*' => "", '(alert|server): ' => "", "^: " => ""], $GLOBALS['ULTRASITE'] . ": ") . $p['title'] . " (via " . getenv('HOSTNAME') . ")"; if (!$p['omitdebuginfo']) { @@ -251,6 +251,7 @@ static function error($p = array()) $body .= "Host: " . getenv('HOSTNAME') . "\n\n"; $body .= $p['id'] ? "Filter: timewindow=" . $p['graceperiod'] . "-" . ($p['graceperiod'] + $p['timewindow']) . "\n\n" : ""; $body .= "Time: " . date("Y-m-d H:i:s") . "\n\n"; # no it::date() because of time- debug param + $body .= "Overview: ssh " . getenv('HOSTNAME') . " 'tail -100000 /tmp/alertdata/alert.log | grep \"$trace\"'\n\n"; $body .= $_GET ? "\$_GET: " . var_export($_GET, true) . "\n\n" : ""; $body .= $_POST ? "\$_POST: " . var_export($_POST, true) . "\n\n" : ""; $body .= $_COOKIE ? "\$_COOKIE: " . var_export($_COOKIE, true) . "\n\n" : ""; @@ -262,7 +263,8 @@ static function error($p = array()) $body = it::replace(array('(pw|passw|password|secret)(\] => |=)[^&\s]*' => '$1$2********'), $body, array('utf8' => false)); } - it::mail(array('To' => $p['to'], 'Subject' => substr($p['title'], 0, 160), 'Body' => $body, 'Cc' => $GLOBALS['it_defaultconfig']['error_cc'], 'forcemail' => !it::is_devel())); + it::mail(array('To' => $p['to'], 'Subject' => "Alert: " . substr($p['title'], 0, 160), 'Body' => $body, 'Cc' => $GLOBALS['it_defaultconfig']['error_cc'], 'forcemail' => !it::is_devel())); + $p['title'] = "Mail: " . $p['title']; } else if ($_SERVER['REMOTE_ADDR']) # toscreen mode: web echo "
" . htmlspecialchars($p['title'] . "\n" . rtrim($body), ENT_COMPAT, "iso-8859-1") . "
"; # works with iso-8859-1 or utf-8, UTF8SAFE -- cgit v1.2.3