From f6e4af3c6f2e79e0c92a41031b9d967d3927dac7 Mon Sep 17 00:00:00 2001 From: Urban Müller Date: Mon, 8 Jan 2018 11:04:33 +0100 Subject: add body to alertlog --- it.class | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'it.class') diff --git a/it.class b/it.class index a65e98b..3a36510 100644 --- a/it.class +++ b/it.class @@ -266,7 +266,7 @@ static function error($p = array()) $body .= $p['id'] ? "Filter: timewindow=" . $p['graceperiod'] . "-" . ($p['graceperiod'] + $p['timewindow']) . " (previous err: " . it::date('', $errstamp) . ")\n\n" : ""; $body .= $origp['blockmail'] ? "Block-resend: " . $origp['blockmail'] . " seconds\n\n" : ""; $body .= "Overview: ssh " . getenv('HOSTNAME') . " 'cat /tmp/alertdata/alertlog | grep \"$trace\"'\n\n"; - $body .= ($t = it::exec('grep {0} /tmp/alertdata/alertlog 2>/dev/null | cut -d : -f 1-2 | sort | uniq -c | tail -10', $trace)) ? "Histogram: (last 10 minutes)\n$t\n" : ""; + $body .= ($t = it::exec('grep {0} /tmp/alertdata/alertlog 2>/dev/null | grep ^2 | cut -d : -f 1-2 | sort | uniq -c | tail -10', $trace)) ? "Histogram: (last 10 minutes)\n$t\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" : ""; @@ -284,13 +284,13 @@ static function error($p = array()) 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 else # toscreen mode: shell (outputs to stderr) - error_log(substr($p['title'], 0, 100000) . " in " . ($trace ? $trace : " {$p['file']}:{$p['line']}") . " Url: $url " . (EDC('verboseerrors') ? D($p['locals']) : "")); + error_log(substr($p['title'], 0, 100000) . " in " . ($trace ? $trace : " {$p['file']}:{$p['line']}") . " Url: $url " . (EDC('verboseerrors') ? D($p['body']) : "")); } if ($_SERVER['REMOTE_ADDR']) # additional entry in log/error_log error_log("it::error: " . $p['title'] . " Url: $url"); - it::log("/tmp/alertdata/alertlog", $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url"); + it::log("/tmp/alertdata/alertlog", $p['title'] . " in " . ($trace ? $trace : "{$p['file']}:{$p['line']}") . " Url: $url" . ($p['body'] ? "\n" . substr($p['body'], 0, 5000) . "\n" : "")); if ($p['fatal']) exit(99); -- cgit v1.2.3