Greetings Forum,
I am a happy user of the Asuswrt-Merlin firmware, & I have recently sought to expand on some of the cool capabilities that it offers us. One thing I did was format a big USB stick, put it in the router and use some custom init scripting to output the syslog file to the USB stick. Many thanks to the participants in this thread for helping show the way for me.
So now, I can point the system log to the USB drive & make it persist across boots. The next step for me is to prune the log based on logrotate rules. This is where I'm having an issue. I have the logrotate conf set up as discussed in the thread from above. However, when I try to test the conf using logrotate -dv, I get an odd error:
It would seem the version of logrotate included from the entware suite is expecting the canonical "root" user to be defined in /etc/passwd. We have a root user, but it is not named "root", and I think older revs of logrotate might be hardcoded to need that user name.
If I add shadow-useradd from entware and sneak in a root user, then logrotate will do its debug run successfully, and I can use the "su" rule within the logrotate.conf file to execute under the user I wish. The problem with this kludge is that it will not persist across router reboots. The passwd file must be restored from nvram or something, clobbering any customizations I might try. I also attempted to be a little clever and invoke useradd from some of the jffs custom scripts, post-mount, init-start, etc. but it seems like those events must take place before the stock passwd file is restored.
Has anyone encountered this hurdle with setting up logrotate for their system log? If so, how did you surpass it, if at all? Are there newer logrotate sources available, or did you find a way to keep the "root" user alive across reboot, or something else?
TIA,
-Mike
I am a happy user of the Asuswrt-Merlin firmware, & I have recently sought to expand on some of the cool capabilities that it offers us. One thing I did was format a big USB stick, put it in the router and use some custom init scripting to output the syslog file to the USB stick. Many thanks to the participants in this thread for helping show the way for me.
So now, I can point the system log to the USB drive & make it persist across boots. The next step for me is to prune the log based on logrotate rules. This is where I'm having an issue. I have the logrotate conf set up as discussed in the thread from above. However, when I try to test the conf using logrotate -dv, I get an odd error:
Code:
logrotate -dv /opt/etc/logrotate.conf
Ignoring /opt/etc/logrotate.conf because there's no password entry for the owner.
Handling 0 logs
It would seem the version of logrotate included from the entware suite is expecting the canonical "root" user to be defined in /etc/passwd. We have a root user, but it is not named "root", and I think older revs of logrotate might be hardcoded to need that user name.
If I add shadow-useradd from entware and sneak in a root user, then logrotate will do its debug run successfully, and I can use the "su" rule within the logrotate.conf file to execute under the user I wish. The problem with this kludge is that it will not persist across router reboots. The passwd file must be restored from nvram or something, clobbering any customizations I might try. I also attempted to be a little clever and invoke useradd from some of the jffs custom scripts, post-mount, init-start, etc. but it seems like those events must take place before the stock passwd file is restored.
Has anyone encountered this hurdle with setting up logrotate for their system log? If so, how did you surpass it, if at all? Are there newer logrotate sources available, or did you find a way to keep the "root" user alive across reboot, or something else?
TIA,
-Mike