The danger of "q=$1"; or, why you shouldn't ignore Drupal 404 errors.

Drupal makes your life very easy, but that's no excuse for being lazy. While profiling scripts today, I ran into something that, for whatever reason, never clicked before. I was running Xdebug and KCachegrind on some complex pages to get an idea where I could optimize. Xdebug has a profiler built in that creates files digestible by something like KCachegrind. With profiling on, you get a profile dump file for every PHP script you run. You can in-turn open that file with KCachegrind to get some helpful analysis.
Profiling is a great way to expose those problems that I often ignore...





Mike Carter
How can you handle the
How can you handle the thousands of bad 404 requests from remote servers though? Usually vulnerability attempts for IIS/ASP, but still causing 404 errors to clutter the watchdog log.
Kevin Hankens
Yeah, it can definitely be
Yeah, it can definitely be tough in a production environment. You might have to use some log parsing tools (Splunk for example), or just some text processing tools to remove the noise. For example, start by looking for common file extensions within the 404 errors. Though you might get a quick win by watching the logs on a dev environment. You'd quickly see the above CSS example that causes multiple bootstraps for every page request. Analyzing logs can be tedious, but well worth the effort when you can improve site performance.
--
Kevin Hankens
Acquia Professional Services