Is it possible to create a log file (for example not_found.log) with only 404 HTTP Status Code with Apache2?
Just like this: http://www.helicontech.com/articles/mod_log_config-capabilities/ (Per status code differentiation)
The main problem with this solution is that when status doesn’t match, each log will contain a non-informative record like this (--,- -- -):
cat /var/log/apache2/not_found.log
[28/Aug/2013:16:45:42 +0200] 192.168.1.0.,Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.15 /index.php/LogApache/titi 404
[28/Aug/2013:16:45:43 +0200] 88.191.153.141,Opera/9.80 (X11; Linux x86_64) Presto/2.12.388 Version/12.15 /favicon.ico 404
- -,- -- -
- -,- -- -
My goal is to count 404 hits and it takes too many time to parse an access_log with more than 1 000 000 lines, that's why I just want to run a wc -l on not_found.log.
Thank you in advance for your help,
Best regards,
That's 23 seconds to count 404s in a file with 10,000,000 lines. Not fast enough?