Web lists-archives.com

Re: [Samba] Logrotate





Am 14.05.2018 um 21:08 schrieb Reindl Harald via samba:
> Am 14.05.2018 um 20:56 schrieb Carlos via samba:
>> /opt/samba/var/log.samba
>>
>> {
>>   rotate 10
>>         daily
>>         compress
>>         dateext
>>         size 100M
>>         nomail
>>         missingok
>>         notifempty
>>         create 644 root root
>>         #postrotate
>>         #        systemctl stop samba &> /dev/null
>>         #        systemctl start samba &> /dev/null
>>         #endscript
>> }
>>
>> -- 
>>
>>
>> My problem is, when logrotate is executed, log is rotate but after ,
>> don't log messages anymore, log.samba is was"zero"., is need restart in
>> samba, then log message is back
> 
> that's why postrotate and SIGHUP exists
> a proper systemd unit should have ExecReload
> 
> if not make a drop-in: /etc/systemd/system/samba.service.d/reload.conf
> [Service]
> ExecReload=/usr/bin/kill -HUP $MAINPID
> 
> after create folder and file: systemctl daemon-reload
> 
> stop/sart would be wrong anyways - that's what RESTART is for

and proper distributions ship logrotate configs by default

copytruncate
Truncate the original log file in place after creating a copy, instead
of moving the old log file and optionally creating a new one. It can be
used when some program cannot be told to close its logfile and thus
might continue writing (appending) to the previous log file forever.
Note that there is a very small time slice between copying the file and
truncating it, so some logging data might be lost. When this option is
used, the create option will have no effect, as the old log file stays
in place.

[root@srv-rhsoft:~]$ cat /etc/logrotate.d/samba
/var/log/samba/* {
    notifempty
    olddir /var/log/samba/old
    missingok
    sharedscripts
    copytruncate
}

-- 
To unsubscribe from this list go to the following URL and read the
instructions:  https://lists.samba.org/mailman/options/samba