The watchdog module monitors your website, captures system events in a log and records them to be reviewed by an authorized individual at a later time. The watchdog log is simply a list of events recorded during operation and contains usage data, performance data, errors, warnings and operational information. It is vital to check the watchdog report on a regular basis as it is often the only way to tell what is going on.

To ease administration, the watchdog will automatically discard old log entries.

format_interval(3600), 10800 => format_interval(10800), 21600 => format_interval(21600), 32400 => format_interval(32400), 43200 => format_interval(43200), 86400 => format_interval(86400), 172800 => format_interval(172800), 259200 => format_interval(259200), 604800 => format_interval(604800), 1209600 => format_interval(1209600), 2419200 => format_interval(2419200)); $output .= form_select(t("Discard entries older than"), "watchdog_clear", variable_get("watchdog_clear", 604800), $period, t("The time watchdog entries should be kept. Older entries will be automatically discarded. Requires crontab.")); return $output; } function watchdog_cron() { db_query("DELETE FROM watchdog WHERE ". time() ." - timestamp > ". variable_get("watchdog_clear", 604800)); } function watchdog_overview() { $colors = array(message => "#FFFFFF", special => "#836FFF", warning => "#FFAA22", error => "#EE2C2C"); $result = db_query("SELECT w.*, u.userid FROM watchdog w LEFT JOIN users u ON w.user = u.id ORDER BY timestamp DESC LIMIT 1000"); $output .= "\n"; $output .= " \n"; while ($watchdog = db_fetch_object($result)) { if ($color = $colors[$watchdog->type]) { $output .= " \n"; } } $output .= "
datetypemessageuseroperations
". format_date($watchdog->timestamp) ."$watchdog->link". substr(check_output($watchdog->message), 0, 50) ."". format_username($watchdog->userid) ."id\">details
\n"; return $output; } function watchdog_view($id) { $result = db_query("SELECT l.*, u.userid FROM watchdog l LEFT JOIN users u ON l.user = u.id WHERE l.id = '$id'"); if ($watchdog = db_fetch_object($result)) { $output .= "\n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= " \n"; $output .= "
Type:". check_output($watchdog->type) ."
Date:". format_date($watchdog->timestamp, "large") ."
User:". format_username($watchdog->userid) ."
Location:". check_output($watchdog->location). "
Message:". check_output($watchdog->message) ."
Hostname:". check_output($watchdog->hostname) ."
\n"; return $output; } } function watchdog_admin() { global $op, $id, $order; print "overview | help
\n"; switch ($op) { case "help": watchdog_help(); break; case "view": print watchdog_view(check_input($id)); break; default: print watchdog_overview(); } } ?>