On a rather busy D6 site, I need to truncate watchdog table very frequently, since it grows at about few Gigabyes per day. On the other hand I can not disable access logs to avoid the table's inflation. Running cron yeilds a lot of errors and does not seem to clean watchdog table. So what is the best way to deal with this problem?


  • 1
    what kind of messages are filling it up? what kind of errors is cron spitting out? – Jimajamma Mar 22 '12 at 0:06
  • If there are errors thrown there. Try solving them may be even notices. This will make ur site even faster. – Hacker Mar 22 '12 at 8:15

Without knowing what kinds of errors you are seeing, it is hard to say what to do. If this is a live site, then I suggest that you edit your settings.php to turn off PHP error reporting. IIRC, this will do it for you

ini_set('display_errors', FALSE);
ini_set('display_startup_errors', FALSE);

or you could also edit your php.ini and do the same thing, or use the equivalent .htaccess directives. You may get by with just turning off E_NOTICE.

If you are seeing favicon.ico errors in the in the log, then I suggest putting in a rewrite to point to the favicon in your theme, or at least on in one of the standard themes.

Another possible watchdog clogger are the internal connection messages. You can try adding

# make sure internal dummy connections don't make it into drupal
RewriteCond %{HTTP_USER_AGENT} ^.*internal\ dummy\ connection.*$ [NC]
RewriteRule .* - [F,L]

to .htaccess if you are seeing them.

All of this said, if you are seeing several gigs of errors or warnings in your watchdog, then you have a serious problem with your site. Clone the site to a development version, and figure out what is really going on: fix the actual problem (ie, stop the errors) instead of curing a symptom (ie, hiding the error messages).

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.