Suppressing APC cache warning messages in watchdog log My Drupal-oriented shared webhost recently updated PHP and APC and turned on reporting APC warnings. Now my watchdog log has many, many entries of the form Warning: include() [function.include]: Unable to allocate memory for pool, indicating that sometimes the cache is overflowing.

I know what these warnings mean: that's not my question. The APC cache is 96MB, which is big enough most of the time. But I have 127 enabled modules and certain page loads or doing admin work will overflow the cache. This doesn't occur on every page load by any means, but the warnings are filling up the log, making it hard to find more interesting entries, and causing the log to wrap more often than I'd like. I'm trying to cut down my needed modules but nearly all are there for good reasons.

I cannot change most of the APC settings (I might wish to use apc.filters, for instance).

Is there any module or other method that you know of that will filter messages before they get put in the log? I could make the log bigger, but I still have the problem of finding the wheat in the chaff of warnings.
You can create a module to use the hook_watchdog function. This hook would kick in when there is an error so you can check the type of error decide not to write it to the table. But the variable seems to be passed not as a reference and hence I dont think you would be able to change the variable it self. 

The logs are written to the table by the dblog module. using the hook implementation of the dblog module. Just make sure that your function gets called after this so that the entry is already in the db. this should be the case already if not you can set the priority in the systems table to make this effect. 

Now within your hook function you can decide to delete the entry that is just written. 

function dblog_watchdog(array $log_entry) {
  Database::getConnection('default', 'default')-&gt;insert('watchdog')
    -&gt;fields(array(
    'uid' =&gt; $log_entry['uid'], 
    'type' =&gt; substr($log_entry['type'], 0, 64), 
    'message' =&gt; $log_entry['message'], 
    'variables' =&gt; serialize($log_entry['variables']), 
    'severity' =&gt; $log_entry['severity'], 
    'link' =&gt; substr($log_entry['link'], 0, 255), 
    'location' =&gt; $log_entry['request_uri'], 
    'referer' =&gt; $log_entry['referer'], 
    'hostname' =&gt; substr($log_entry['ip'], 0, 128), 
    'timestamp' =&gt; $log_entry['timestamp'],
  ))
    -&gt;execute();
}


Another option would to create a hook_cron in your module and delete the wantchdog entries you dont want during the cron run.