[Samba] Logrotate

Carlos carlos.hollow at gmail.com
Mon May 14 20:29:15 UTC 2018


Thanks!!!

Resolve with option "copytruncate" :-D

Regards;

On 14-05-2018 16:10, Reindl Harald via samba wrote:
>
> 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 at srv-rhsoft:~]$ cat /etc/logrotate.d/samba
> /var/log/samba/* {
>      notifempty
>      olddir /var/log/samba/old
>      missingok
>      sharedscripts
>      copytruncate
> }
>




More information about the samba mailing list