RsyslogD + Logrotate + LogD

I've installed RsyslogD and have it working the way I want. The only issue is now logd stops logging to /var/log/messages after the first day. I assume logrotate is causing problems? How can I fix this?

If I ptrace logd, it looks like ubusd is having problems with a missing file?? "kill -HUP <ubusd> seems to make logs flow again, but I'm not sure why.

strace -p <pid>
epoll_pwait(3, [], 10, 1000, NULL, 8)   = 0
socket(AF_UNIX, SOCK_STREAM, 0)         = 12
fcntl(12, F_GETFD)                      = 0
fcntl(12, F_SETFD, FD_CLOEXEC)          = 0
connect(12, {sa_family=AF_UNIX, sun_path="/var/run/udebug.sock"}, 110) = -1 ENOENT (No such file or directory)
close(12)                               = 0

# cat /etc/logrotate.d/rsyslogd.files 
/mnt/sda2/var/log/messages /mnt/sda2/var/log/secure /mnt/sda2/var/log/cron
	create 640 root root

	# ftpd doesn't handle SIGHUP properly
	rotate 4
 		/etc/init.d/rsyslog restart

Don't rely on logrotate if you do not have to, it's crap. rsyslog can rotate output files well on its own, using a dynaFile stanza with its omfile module.

that's harsh.

I've been using it for many years, without any hick ups, not on OpenWRT though, but vanilla Linux.

1 Like

Same here, I have both rsyslog å logrotate on a free standing log server with Ubuntu server.

They are both actually default system
Log handlers on Ubuntu.

So there is no fault on either one. But especially rsyslog requires a lot of sophistication to set up. Mostly because the world log file standard doesn’t exist.

But still, if you ask me the best way to work with the logs is to send them somewhere from the OpenWrt device.

I don’t think you can have both doing the same thing at the same time.
Also remember that writing log to a router memory is pretty much a memory destroyer!