I need to set watchdog log entries to unlimitted. Now it clears every time when cron is called.


now maximum is 100000, is there any better way to do this.


Just change the setting to "ALL" that should work. Please see the screen below !

enter image description here

Cron will run only if minimum limit is set in the select box see the below code in dblog module.

function dblog_cron() {
  // Cleanup the watchdog table.
  $row_limit = variable_get('dblog_row_limit', 1000);

  // For row limit n, get the wid of the nth row in descending wid order.
  // Counting the most recent n rows avoids issues with wid number sequences,
  // e.g. auto_increment value > 1 or rows deleted directly from the table.
  if ($row_limit > 0) {
    $min_row = db_select('watchdog', 'w')
      ->fields('w', array('wid'))
      ->orderBy('wid', 'DESC')
      ->range($row_limit - 1, 1)

    // Delete all table entries older than the nth row, if nth row was found.
    if ($min_row) {
        ->condition('wid', $min_row, '<')

If we select value as "ALL" which is 0, Cron won't delete any entries !

For Drupal 6,

You can use Elysia Cron module, to turn off the dblog_cron feature.

Elysia Cron Module tells,

Turn off (disable) a cron task/feature you don't need.

| improve this answer | |
  • Updated solution for D6 :-) – Anil Sagar Sep 27 '12 at 5:59

Never flushing your Watchdog log via CRON or at least manually clearing the log every so often will eventually cause you problems. If you are on a dedicated or virtual Linux host consider using Syslog instead of Watchdog for your Drupal logging (available in both Drupal 6 and 7.)

This will allow you to keep an unlimited and permanent log of your Drupal events. The setup guide also shows you how to use logrotate so log files don't get out of hand.

This will likely have a huge impact on performance as well. This is due to being able to prevent the excessive DB writes that Watchdog initiates.

Excerpt from Drupal.org regarding the Syslog module

Install & configure the Syslog module

Go to the Modules page, /admin/build/modules, and install the Syslog module. Then go to the Syslog settings page, /admin/settings/logging/syslog (D6) or the Logging and errors configuratiion page, admin/config/development/logging (D7), and select which Syslog level to attach to the log messages. Choose one that is not in use by Syslog

Configure Syslog to Log to a Separate File

Edit /etc/syslog.conf and add:

local0.* /var/log/drupal.log

(if local0 is the level that you configured Syslog to use in Step 1)

Then, restart Syslog:

service syslog restart

Note that this is optional. If you do not do this, your messages will most likely be in /var/log/messages.

Disable the Database Logging (formerly, Watchdog) Module

Check that you are seeing messages in the syslog by using

tail /var/log/drupal.log

You can also browse the file by using less.

If it is working, you may now go to the modules page and disable Dblog.

For complete entry, visit Syslog: OS-integrated logging

| improve this answer | |
  • If you are going to use dblog (aka can't use syslog due to a shared environment or other BS), what do you think is a reasonable upper boundary for number of log entries? – areynolds Sep 20 '13 at 23:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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