LDAP authentication logging in DEBUG by default
- Python version: 3.7.3
- NetBox version: 2.9.3
- Debian: 10.6
During deployment, the LDAP authentication logging feature present in netbox/netbox/authentication.pyis set by default to DEBUG. This can be problematic in different context, in particular in production environment. In particularly dynamic environment with many users, it can make the different log files growing exponentially.
Steps to Reproduce
- Run netbox with LDAP backend support
- Logs files will increase in size when someone will connect
- Too many information are printed by default with
DEBUGmode
Expected Behavior
By default, the application should not be in DEBUG mode, but more in INFO or WARNING, except if a "switch" could be easily modified.
I have made a quick modification there: https://github.com/niamtokik/netbox/tree/authentication-debug-logging-removal
Observed Behavior
- Logging files growing exponentially.
- Too many information logged
See also #5192, #5194
This issue managed to create 10GB+ syslog files on our server in a matter of an hour or 2... with just 1 person working on documenting parts of our network.
Doing a quick analysis of one of these files showed large entries of LDAP search results, sometimes being written to the log 20k+ times per second. The lines all indicated gunicorn was the source and most of them started with search_s(
@glennmatthews - Thanks for finding this... I knew something had its logging set in debug mode, but I couldn't figure out where the setting was.
The lines all indicated gunicorn was the source and most of them started with search_s(
it's probably due to the DEBUG level used in LDAP authentication part. This snippet use another handler to log message, and should be configured to send them to stdin or stderr by default.
@niamtokik Were you going to commit your changes as a PR? If not, I'll snap it up...
Were you going to commit your changes as a PR? If not, I'll snap it up...
Yes, I will create the PR right now.