How can I increase the log level of winbind or samba without restarting the services?
Environment
- Red Hat Enterprise Linux 8+
- Red Hat Enterprise Linux 6 and 7 (Refer Diagnostic Steps for workaround)
- Samba >= 3
Issue
- I don't want to restart winbind or samba to increase the log levels.
- I need increased logging while a problem is occurring but increasing the log level through the smb.conf requires a restart of the services which can temporarily fix an issue and requires me to wait for another occurrence to get the logs I need.
- Continuous level 10 logging can cause a performance hit and fill up disk space.
Resolution
smbcontrol can send messages to control smbd, nmbd or winbind process
Note: RHEL 7 hosts are affected by Bug This content is not included.205004 - smbcontrol winbindd debug is not possible,
which prevent change log level of running process. Refer Diagnostic Steps for workaround.
1. Query current debug level (optional)
To query the current log level of smb, winbind, and nmbd
# smbcontrol smbd debuglevel
# smbcontrol winbind debuglevel
# smbcontrol nmbd debuglevel
The output for smbcontrol smbd debuglevel looks like:
PID 56898: all:10 tdb:10 printdrivers:10 lanman:10 smb:10 rpc_parse:10 rpc_srv:10 rpc_cli:10 passdb:10 sam:10 auth:10 winbind:10 vfs:10 idmap:10 quota:10 acls:10 locking:10 msdfs:10 dmapi:10 registry:10 scavenger:10 dns:10 ldb:10 tevent:10 auth_audit:10 auth_json_audit:10 kerberos:10 drs_repl:10 smb2:10 smb2_credits:10 dsdb_audit:10 dsdb_json_audit:10 dsdb_password_audit:10 dsdb_password_json_audit:10 dsdb_transaction_audit:10 dsdb_transaction_json_audit:10 dsdb_group_audit:10 dsdb_group_json_audit:10
2. Set the debug level
To set the log level of smb, winbind, and nmbd
# smbcontrol smbd debug 10
# smbcontrol winbind debug 10
# smbcontrol nmbd debug 10
A. Advanced Usages
You can also set the log level for a specific samba process, like:
# smbcontrol <pid> debug 10
or query the current level:
# smbcontrol <pid> debuglevel
Root Cause
Increasing the logs while a problem is occurring can help reduce the impact of high log levels over an extended period such as disk usage and system performance. Setting the logs without restarting the daemon is also useful for cases when restarting the service temporarily fixes the problem for a period of time. The drawback is that increasing logs after a problem has occurred may result in missing information but this isn't needed in cases when a reproducer is known.
Diagnostic Steps
If high level log items still not there, it is possible you are affected by Bug This content is not included.205004 - smbcontrol winbindd debug is not possible.
RHEL 8 and later already fixed. RHEL 7 and earlier are still affected.
Workaround
You will need to stop and start Samba services (e.g. smb, winbind) once. After that, you can change log level on the fly.
1. Stop all running Samba services (winbind, smb, nmb)
# service winbind stop; service smb stop
If you also have nmb running:
# service nmb stop
2. Increase log level to maximum
Edit /etc/samba/smb.conf and set the following variables in the [global] section of the config:
log level = 10
debug pid = true
max log size = 0
3. Start the samba services
service winbind start; service smb start
If you also need NetBIOS over IP, start nmb with:
service nmb start
Now you can change the log level on-the-fly without restart samba services.
4. Lower the log level on-the-fly (optional)
If you don't need verbose level now, you can lower it to 0 like:
smbcontrol smbd debug 0
smbcontrol winbind debug 0
If you also have nmb running:
smbcontrol nmbd debug 0
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.