owntone/owntone-server

owntone not using new log file after rotate

frankusb opened this issue · 8 comments

  • steps to reproduce and/or logging of the error
    After logrotate occurs, generate a log message and see that it appears in owntone.log.1. After owntone.log.1 is compressed, logging ceases. Restarting owntone will log in owntone.log.

  • version of owntone
    origin/master

  • platform
    Debian 12

I see this should occur from SIGHUP.

	  case SIGHUP:
	    DPRINTF(E_LOG, L_MAIN, "Got SIGHUP\n");

	    if (!main_exit)
	      logger_reinit();
	    break;

I think adding the below to /etc/logrotate.d/owntone

        postrotate
                /bin/kill -HUP `pgrep -x owntone`
        endscript

Thank you, I am using your version now.

How are you getting away with create defaulting to root:root ownership? It seems like it would need to be create 0644 owntone root.

That makes sense. The weird thing I can't figure out what changed, log rotation has been working for years now and all of a sudden stopped. No matter, I understand how it works in owntone and I will figure the rest out. Thank you for the pointers.

I won't be running it as root though.

I verified logrotate worked correctly today during the weekly rotate. The below worked for me.

/var/log/owntone.log {
        weekly
        missingok
        notifempty
        rotate 3
        create 0644 owntone root
        compress
        delaycompress
        noolddir
        postrotate
                killall -q -HUP owntone
        endscript