no_404_log
No 404 Log is a lightweight module for Drupal 9, 10, and 11 that prevents "Page not found" (404) events from being written to the watchdog log. It helps keep logs clean by suppressing all 404 entries or filtering only specific paths using PCRE regular expressions — with zero impact on how Drupal handles or renders 404 pages.
⚠️ This module does not block any requests. If a URL matches a configured pattern and the corresponding resource exists, it will still be served normally. The only effect is that the associated 404 watchdog entry is not written to the log. This module is a log‑cleanup utility, not a security or access‑control mechanism.
Features
- Suppresses 404 log events across all PSR‑3 logging channels (DBLog, Syslog, Monolog, …)
- Global suppression mode — one checkbox to silence every 404 entry
- Regex‑based filtering — suppress only specific paths using PCRE patterns (one per line)
- Ships with a curated set of default patterns covering common bot probes: WordPress endpoints, leaked‑secret paths, PHP diagnostic files, database admin panels, and more
- Optional hard override via
settings.php— takes effect before config is loaded, ideal for local dev environments - Does not alter how 404 pages are rendered or delivered to end users
- No content types, fields, blocks, or text formats added — logging behavior only
- Compatible with Drupal 9, 10, and 11 (requires PHP 7.4+)
Use Cases
- Reducing noise in DBLog caused by bots and scanners constantly probing WordPress or other CMS paths
- Lowering storage and processing costs in third‑party log aggregation systems (Splunk, Datadog, Graylog, Elastic…)
- Improving signal‑to‑noise ratio when debugging real application issues
- Keeping watchdog readable on high‑traffic sites without disabling 404 logging entirely
Post‑Installation
After enabling the module, visit the configuration page:
/admin/config/development/no_404_log
(Administration » Configuration » Development » No 404 Log)
Two modes are available:
- Ignore all 404 logs — suppresses every 404 entry unconditionally.
- Regex pattern filtering — suppresses only entries whose URI matches one of the listed PCRE patterns. Each pattern goes on its own line. Invalid patterns are flagged on save and silently skipped at runtime.
Optionally, add this line to settings.php to suppress all 404 logs at the infrastructure level, before any configuration is loaded:
$settings['no404log_enabled'] = TRUE;
This setting always takes priority over the admin UI and is especially useful in local development environments.
Additional Requirements
This project has no dependencies beyond Drupal core.
It uses Drupal's built‑in PSR‑3 logging services and requires no additional libraries or modules.
Recommended Modules
Not required, but work well alongside No 404 Log:
- Syslog — offload logs to the operating system logger
- Monolog — advanced logging channels and handlers
- Database Logging (DBLog) — Drupal core module that writes log entries to the database