log brokenlinks to logfile and config fail2ban to ban crawlers hitting many 404 pages.
django-appconf
$ pip install django-brokenlinks
- Add
'brokenlinks'to INSTALLED_APPS - Add
'brokenlinks.middleware.BrokenLinkEmailsMiddleware'toMIDDLEWARE_CLASSES - Set the
BROKENLINKS_LOG_PATH - After change in brokenlinks configs run
manage.py createbrokenlinksconfsonce and use the result conf-files with fail2ban
your settings.py will look like below:
- INSTALLED_APPS = (
- # ... 'brokenlinks', # ...
)
- MIDDLEWARE_CLASSES= (
- 'brokenlinks.middleware.BrokenLinkEmailsMiddleware', # ...
)
BROKENLINKS_LOG_PATH = '/path/to/brokenlinks.log'
then config fail2ban to use it
- w.Tayyeb