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
unit File
Using smbd -d 3 also fails.
File:
/usr/lib/systemd/system/smb.service
Contents:
ExecStart=/usr/bin/smbd -d 3 --foreground --no-process-group $SMBDOPTIONS
systemctl daemon-reload
systemctl restart smb.service
Question
How do I change the Samba log level on Manjaro?
Mike
Maybe it checks to see if the logfile is being directed to a writable location before it honors the change in verbosity level? 
How is the location defined in your config?
Perhaps specifying it as a number is not current anymore?
(if it ever was, IDK)
I do not have samba installed, so I looked up:
man smb.conf
and got this:
smb.conf
perhaps that helps
⦠it is not Manjaro specific ā¦
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.
# PowerShell
Get-ChildItem -Path "/var/log/samba" |
Where-Object { $_.LastWriteTime -ge ((Get-Date).AddMinutes(-5))} |
Sort-Object -Property LastWriteTime -Descending |
Format-Table -AutoSize
Directory: /var/log/samba
UnixMode User Group LastWriteTime Size Name
-------- ---- ----- ------------- ---- ----
-rw-r--r-- root root 5/3/2022 21:20 4476 log.smbd
-rw-r--r-- root root 5/3/2022 21:20 7592 log.samba-dcerpcd
-rw-r--r-- root root 5/3/2022 21:20 744 log.rpcd_lsad
-rw-r--r-- root root 5/3/2022 21:20 744 log.rpcd_mdssvc
-rw-r--r-- root root 5/3/2022 21:20 744 log.rpcd_rpcecho
-rw-r--r-- root root 5/3/2022 21:20 744 log.rpcd_epmapper
-rw-r--r-- root root 5/3/2022 21:20 744 log.rpcd_fsrvp
-rw-r--r-- root root 5/3/2022 21:20 744 log.rpcd_spoolss
-rw-r--r-- root root 5/3/2022 21:20 14068 log.rpcd_winreg
-rw-r--r-- root root 5/3/2022 21:20 24704 log.rpcd_classic
-rw-r--r-- root root 5/3/2022 21:20 278637 smbd.log
-rw-r--r-- root root 5/3/2022 21:20 46072 2600_1700_1e80_7880_bc92_a917_e0f1_
2fe3.log
-rw-r--r-- root root 5/3/2022 21:20 154076 mobile.log
Remember to lower the log level when you are done troubleshooting.
[global]
# log level = 3
systemctl restart smb.service