Try to standardize some logging output. Move article retrieve errors from newsportal.log to debug.log.
This commit is contained in:
parent
d17d058ead
commit
8724e66c51
|
@ -1 +1 @@
|
|||
0.9.137
|
||||
0.9.138
|
||||
|
|
|
@ -44,6 +44,7 @@ if ($free_spool_disk_space < $min_spool_disk_space) {
|
|||
|
||||
$logdir = $spooldir . '/log';
|
||||
$debug_log = $logdir . '/debug.log';
|
||||
$abuse_log = $logdir . '/abuse.log';
|
||||
$lockdir = $spooldir . '/lock';
|
||||
$ssldir = $spooldir . '/ssl/';
|
||||
$user_ban_file = $config_dir . '/banned_names.conf';
|
||||
|
|
|
@ -185,7 +185,7 @@ function message_parse($rawmessage)
|
|||
*/
|
||||
function message_read($id, $bodynum = 0, $group = "")
|
||||
{
|
||||
global $CONFIG, $config_dir, $config_name, $cache_articles, $spooldir, $spoolpath, $logdir, $text_error, $ns;
|
||||
global $CONFIG, $config_dir, $config_name, $cache_articles, $spooldir, $spoolpath, $logdir, $debug_log, $text_error, $ns;
|
||||
$logfile = $logdir . '/newsportal.log';
|
||||
if (! testGroup($group)) {
|
||||
echo $text_error["read_access_denied"];
|
||||
|
@ -262,7 +262,7 @@ function message_read($id, $bodynum = 0, $group = "")
|
|||
}
|
||||
}
|
||||
if (! isset($rawmessage) || $rawmessage === FALSE) {
|
||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " DEBUG: Requesting: " . $group . ":" . $id . " from server", FILE_APPEND);
|
||||
file_put_contents($debug_log, "\n" . format_log_date() . " " . $config_name . " Unable to retrieve: " . $group . ":" . $id . " from local server", FILE_APPEND);
|
||||
if (! isset($ns)) {
|
||||
$ns = nntp_open();
|
||||
}
|
||||
|
|
|
@ -2101,7 +2101,7 @@ function disable_page_by_user_agent($client_device, $useragent, $script = "Page"
|
|||
|
||||
function throttle_hits($client_device = null)
|
||||
{
|
||||
global $CONFIG, $OVERRIDES, $logdir, $config_name, $spooldir;
|
||||
global $CONFIG, $OVERRIDES, $logdir, $abuse_log, $config_name, $spooldir;
|
||||
$rdns_file = $spooldir . '/rdns.dat';
|
||||
$rdns = array();
|
||||
if (file_exists($rdns_file)) {
|
||||
|
@ -2121,7 +2121,7 @@ function throttle_hits($client_device = null)
|
|||
$ua = strtolower($_SERVER["HTTP_USER_AGENT"]);
|
||||
foreach ($OVERRIDES['block_by_user_agent'] as $user_agent) {
|
||||
if (stripos($ua, $user_agent) !== false) {
|
||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Blocking " . $_SERVER['REMOTE_ADDR'] . " '" . $user_agent . "' found in User-Agent block list", FILE_APPEND);
|
||||
file_put_contents($abuse_log, "\n" . format_log_date() . " " . $_SERVER['REMOTE_ADDR'] . " (blocking) '" . $user_agent . "' found in User-Agent block list", FILE_APPEND);
|
||||
$_SESSION['throttled'] = true;
|
||||
header("HTTP/1.0 403 Forbidden");
|
||||
exit();
|
||||
|
@ -2140,7 +2140,7 @@ function throttle_hits($client_device = null)
|
|||
}
|
||||
foreach ($OVERRIDES['block_by_rdns'] as $user_agent) {
|
||||
if (stripos($ua, $user_agent) !== false) {
|
||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Blocking " . $_SERVER['REMOTE_ADDR'] . " '" . $user_agent . "' found in RDNS block list", FILE_APPEND);
|
||||
file_put_contents($abuse_log, "\n" . format_log_date() . " " . $_SERVER['REMOTE_ADDR'] . " (blocking) '" . $user_agent . "' found in RDNS block list", FILE_APPEND);
|
||||
$_SESSION['throttled'] = true;
|
||||
header("HTTP/1.0 403 Forbidden");
|
||||
exit();
|
||||
|
@ -2169,7 +2169,7 @@ function throttle_hits($client_device = null)
|
|||
if (($rate > $loadrate) && ($_SESSION['views'] > 50)) {
|
||||
header("HTTP/1.0 429 Too Many Requests");
|
||||
if (! isset($_SESSION['throttled'])) {
|
||||
file_put_contents($logfile, "\n" . format_log_date() . " " . $config_name . " Too many requests from " . $_SERVER['REMOTE_ADDR'] . " throttling" . " (" . $rate . " > " . $loadrate . ")", FILE_APPEND);
|
||||
file_put_contents($abuse_log, "\n" . format_log_date() . " " . $_SERVER['REMOTE_ADDR'] . " (throttling) too many requests" . " (" . $rate . " > " . $loadrate . ")", FILE_APPEND);
|
||||
$_SESSION['throttled'] = true;
|
||||
}
|
||||
exit(0);
|
||||
|
|
Loading…
Reference in New Issue