[sheepdog-users] logrotate

YunQiang Su wzssyqa at gmail.com
Sun Nov 2 03:15:53 CET 2014


Any result of this talk?

Are this right?
1. send HUP to the main process is a good idea - no matter by
logrotate configure file or by init script
    The problem is that how to determine which one is the main progress?
    Is there a way to do it?

2. if use copytruncate of logrotate: Note that there is a very small
time slice between
    copying the file and truncating it, so some logging data might be lost.




On Thu, Oct 23, 2014 at 10:48 PM, Hitoshi Mitake
<mitake.hitoshi at gmail.com> wrote:
> At Tue, 14 Oct 2014 14:47:39 +0200,
> Valerio Pachera wrote:
>>
>> 2014-10-14 8:42 GMT+02:00 Hitoshi Mitake <mitake.hitoshi at lab.ntt.co.jp>:
>> > Can I close the issue:
>> > https://bugs.launchpad.net/sheepdog-project/+bug/1371434
>> > ?
>>
>> Yes, It's invalid.
>>
>> I've been looking at sheepdog sources but I can't find where
>> 'rotate_log()' is declared.
>> What we need is simply to close and re-open the log file.
>>
>> What do you think about:
>>
>> 1) Find out if the function 'rotate_log()' may overlap with linux 'logrotate'.
>> 2) Create a /var/run/sheep.pid. Distributions' init scripts can simply
>> send -HUP to the right pid (remember we have 2).
>> 3) Debian and other distros create their own init script and logrotate
>> config file.
>
> If configuring log rotation with SIGHUP is not difficult, I think no
> enhancement is required. But the configuration requires the knowledge,
> could you add a description to our wiki and documentation?
>
> Thanks,
> Hitoshi
>
>>
>>
>> *) Debian specific:
>>
>> > Currently I don't know why other daemon processes on debian can adopt
>> > debian's logrotate (for me, there's no event for detecting rename of
>> > logfile). It should be solved in the future. But let's use the
>> > workaround for now.
>>
>> It's not a sheepdog related issue, it was more my mistake.
>> In my first configuration I was not sending any -HUP singnal.
>> Looking at already existing configurations, I see that each time a
>> daemon is involved, -HUP is sent to rotate the log.
>>
>> this is the chain I see:
>>   logrotate -> init script -> start_stop_daemon -> HUP
>>
>> Here's how rsyslog file get rotated.
>>
>> /var/log/syslog
>> {
>>         rotate 7
>>         daily
>>         missingok
>>         notifempty
>>         delaycompress
>>         compress
>>         postrotate
>>                 invoke-rc.d rsyslog rotate > /dev/null
>>         endscript
>> }
>>
>> less /etc/init.d/rsyslog
>>
>> do_rotate() {
>>         DAEMON="$RSYSLOGD_BIN"
>>         PIDFILE="$RSYSLOGD_PIDFILE"
>>
>>         start-stop-daemon --stop --signal HUP --quiet --pidfile
>> $PIDFILE --exec $DAEMON
>> }
>>
>> This is another example about samba
>>
>> /var/log/samba/log.nmbd {
>>         weekly
>>         missingok
>>         rotate 7
>>         postrotate
>>                 [ ! -f /var/run/samba/nmbd.pid ] || kill -HUP `cat
>> /var/run/samba/nmbd.pid`
>>         endscript
>>         compress
>>         notifempty
>> }
>>
>> /var/log/samba/log.smbd {
>>         weekly
>>         missingok
>>         rotate 7
>>         postrotate
>>                 /etc/init.d/samba reload > /dev/null
>>         endscript
>>         compress
>>         notifempty
>> }
>>
>> less /etc/init.d/samba
>>         reload)
>>                 if [ "$RUN_MODE" != "inetd" ]; then
>>                         log_daemon_msg "Reloading /etc/samba/smb.conf"
>> "smbd only"
>>
>>                         start-stop-daemon --stop --quiet --signal HUP
>> --pidfile $SMBDPID
>>
>>                         log_end_msg 0
>>                 fi
>>                 ;;
>> --
>> sheepdog-users mailing lists
>> sheepdog-users at lists.wpkg.org
>> http://lists.wpkg.org/mailman/listinfo/sheepdog-users
> --
> sheepdog-users mailing lists
> sheepdog-users at lists.wpkg.org
> http://lists.wpkg.org/mailman/listinfo/sheepdog-users



-- 
YunQiang Su



More information about the sheepdog-users mailing list