我有桑巴服务器。我已经这样配置 smb.conf:
[global]
# Another configuration
#
#
# Audit Activity Settings
full_audit:prefix = %u|%I|%m|%S
full_audit:success = mkdir rename unlink rmdir pwrite pread
full_audit:failure = none
full_audit:facility = local7
full_audit:priority = NOTICE
[shared]
comment = Shared Content
path = /data/shared
read only = no
browsable = yes
vfs objects = full_audit
Run Code Online (Sandbox Code Playgroud)
我想将 samba 日志扔到特定文件,例如/var/log/samba/log.audit. 我在 rsyslog.conf 中进行了这样的配置:
if $syslogfacility-text == 'local7' and $programname == 'smbd' then /var/log/samba/log.audit
Run Code Online (Sandbox Code Playgroud)
但没有任何反应,没有文件日志 log.audit at /var/log/samba/。
我也尝试过/etc/rsyslog.d/50-default.conf这样配置:
local7.* /var/log/samba/log.audit
Run Code Online (Sandbox Code Playgroud)
但同样,没有文件log.audit日志/var/log/samba/。
但是,Full_Audit 日志可在 syslog 中找到:
Mar 20 02:49:26 media-arsip smbd_audit: content|192.168.84.69|ubspok18|shared|mkdir|ok|sharedcontent/ok/tes
Run Code Online (Sandbox Code Playgroud)
如何将 syslog samba full_audit 日志扔到/var/log/samba/log.audit?
小智 5
也许您已经解决了这个问题,但是对于后代来说:
当我遇到这两个问题(在 CentOS 7 samba 服务器上)时,对我的案例有效的解决方案有两个方面。
首先:当使用上下文配置 vfs full_audit 时local7,日志条目将被发送到 boot.log,该日志已针对该上下文进行配置。在smb.conf full_audit:facility = local5和/etc/rsyslog.conf 中定义新上下文local5.* /var/log/smb_audit.log会将审核日志消息发送到所选日志文件(在我的例子中为/var/log/smb_audit.log)。
其次:经过上述配置后,日志消息被发送到我定义的日志文件和系统日志中。这是因为需要在/etc/rsyslog.conf中为 syslog 禁用 local5,以便 syslog 不会像默认行为一样吸收它们。这是通过添加到/var/log/messageslocal5.none的配置行来完成的,因此它最终会类似于:。*.info;mail.none;authpriv.none;cron.none;local5.none /var/log/messages
(smbcontrol all reload-config && systemctl restart systemd-journald && systemctl restart rsyslog为了使这些更新生效。Journald 不需要重新启动,除非您还选择增加日志限制/速率窗口,尽管对于流量相当大的服务器来说,这可能是可取的。)
| 归档时间: |
|
| 查看次数: |
11145 次 |
| 最近记录: |