I want additional logging for Samba to troubleshoot a problem.
smb.conf
I should be able to increase the log level in smb.conf.
When I set the log level parameter in smb.conf:
File:
/etc/samba/smb.conf
Contents:
[global]
log level = 3
and restart Samba
systemctl restart smb.service
I do not see any additional logging.
> journalctl --since=-5m _SYSTEMD_UNIT=smb.service
May 02 11:51:49 Edward smbd[90043]: [2022/05/02 11:51:49.510175, 0] ../../sour>
May 02 11:51:49 Edward smbd[90043]: smbd version 4.16.0 started.
May 02 11:51:49 Edward smbd[90043]: Copyright Andrew Tridgell and the Samba T>
testparm
Using the verbose output of testparm shows log level = 1.
> testparm -vs | grep "log level"
Load smb config files from /etc/samba/smb.conf
Loaded services file OK.
Weak crypto is allowed
Server role: ROLE_STANDALONE
log level = 1
I save my log file here. %m means that Samba will create a separate log file for each connected client.
/etc/samba/smb.conf
[global]
log file = /var/log/samba/%m.log
Seeing %m made me think there were other logs journalctl was not reading. And I should try reading the log files directly.
It looks like journalctl only sees the banner.
journalctl --since=-5m _SYSTEMD_UNIT=smb.service
May 03 21:20:13 Edward smbd[151026]: [2022/05/03 21:20:13.032298, 0] ../../sou>
May 03 21:20:13 Edward smbd[151026]: smbd version 4.16.0 started.
May 03 21:20:13 Edward smbd[151026]: Copyright Andrew Tridgell and the Samba >
lines 1-3/3 (END)
But reading the smbd.log file shows more detail.
vim -R /var/log/samba/smbd.log
...
[2022/05/03 21:20:13.032298, 0] ../../source3/smbd/server.c:1741(main)
smbd version 4.16.0 started.
Copyright Andrew Tridgell and the Samba Team 1992-2022
[2022/05/03 21:20:13.032359, 2] ../../source3/smbd/server.c:1744(main)
uid=0 gid=0 euid=0 egid=0
[2022/05/03 21:20:13.032596, 2] ../../source3/lib/tallocmsg.c:84(register_msg_pool_usage)
Registered MSG_REQ_POOL_USAGE
[2022/05/03 21:20:13.032609, 2] ../../source3/lib/dmallocmsg.c:78(register_dmalloc_msgs)
Registered MSG_REQ_DMALLOC_MARK and LOG_CHANGED
...
Even journalctl -p 7 does not show anything extra.
So it seems like the problem was that I assumed journalctl would show me all the Samba logs. But I should be going directly to /var/log/samba and reading the logs directly.
And I need to check different log files until I find what I am looking for.