diff options
author | Urban Müller | 2018-01-08 11:04:33 +0100 |
---|---|---|
committer | Urban Müller | 2018-01-08 11:04:33 +0100 |
commit | f6e4af3c6f2e79e0c92a41031b9d967d3927dac7 (patch) | |
tree | ac121c9ae1e82269724b87e977d927cf84f0786a | |
parent | e757700542633a24e71da19d6e9496b8763e118d (diff) | |
download | itools-f6e4af3c6f2e79e0c92a41031b9d967d3927dac7.tar.gz itools-f6e4af3c6f2e79e0c92a41031b9d967d3927dac7.tar.bz2 itools-f6e4af3c6f2e79e0c92a41031b9d967d3927dac7.zip |
add body to alertlog
-rw-r--r-- | it.class | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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 "<pre style='z-index:10000; position:relative; background:white'>" . htmlspecialchars($p['title'] . "\n" . rtrim($body), ENT_COMPAT, "iso-8859-1") . "</pre>"; # 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); |