Xruptor
Regular Contributor
Hello all!
I've been trying to get my Syslog to go on my USB with a rotation. I've tried several variations in attempts to try to get this to work. It just never seems to work correctly and at times I feel like when the syslog is restarted for whatever reason, it defaults back to using the RAM.
I've noticed that depending on where the script goes, SysLog is already full of data. Therefore I have to copy it over and make a link. This only works for awhile and like I said eventually it just stops recording / displaying period. I just don't get.
Right now I'm using post-mount. Hopefully that's the correct place to put it, because everywhere else seems not to work properly.
My OLD script
The above code worked okay for awhile and then suddenly it stopped recording period. When I would check the systemlog on the Asus router page it was blank. It's almost like the log system was restarted. When I checked the log in the USB it was old. Nothing had been recorded. Yet when I check the tmp location it's new but not displayed.
I did some research and found a thread that stated that Asus apparently makes copies of the syslog to USB. I figured that may be the problem. However when I checked it puts it in the root of the USB folder not the /log folder I have it linked to. So there shouldn't be a problem. I figured it had to do something with my copy/moving of the script. So I modified it and the issues still happens.
So I'm reaching out for some help here. All I want is the syslog to be on my USB at all times. Have it only log stuff greater than INFO. Stay within 15MB of space and rotate within 10 logs. I'm hoping someone here can help me discover what is going on.
I've been trying to get my Syslog to go on my USB with a rotation. I've tried several variations in attempts to try to get this to work. It just never seems to work correctly and at times I feel like when the syslog is restarted for whatever reason, it defaults back to using the RAM.
I've noticed that depending on where the script goes, SysLog is already full of data. Therefore I have to copy it over and make a link. This only works for awhile and like I said eventually it just stops recording / displaying period. I just don't get.
Right now I'm using post-mount. Hopefully that's the correct place to put it, because everywhere else seems not to work properly.
My OLD script
Code:
#!/bin/sh
killall syslogd
# Copy old syslog and create symlink to new
cat /tmp/syslog.log >> /tmp/mnt/sda1/logs/syslog.log
mv /tmp/syslog.log /tmp/mnt/sda1/logs/kern.log
ln -s /tmp/mnt/sda1/logs/syslog.log /tmp/syslog.log
# initiate syslogd move log, only show messages higher than INFO,
# max size before rotation 15000kb, keep only 10 rotated logs
syslogd -m 0 -O /tmp/mnt/sda1/logs/syslog.log -S -l 6 -s 15000 -b 10
logger -p NOTICE -t USBSYSLOGD \"USB syslogd logging started.\"
The above code worked okay for awhile and then suddenly it stopped recording period. When I would check the systemlog on the Asus router page it was blank. It's almost like the log system was restarted. When I checked the log in the USB it was old. Nothing had been recorded. Yet when I check the tmp location it's new but not displayed.
I did some research and found a thread that stated that Asus apparently makes copies of the syslog to USB. I figured that may be the problem. However when I checked it puts it in the root of the USB folder not the /log folder I have it linked to. So there shouldn't be a problem. I figured it had to do something with my copy/moving of the script. So I modified it and the issues still happens.
Code:
#!/bin/sh
killall syslogd
# Copy old syslog as backup kern file and create symlink to new
mv /tmp/syslog.log /tmp/mnt/sda1/logs/kern.log
ln -s /tmp/mnt/sda1/logs/syslog.log /tmp/syslog.log
# initiate syslogd move log, only show messages higher than INFO,
# max size before rotation 15000kb, keep only 10 rotated logs
syslogd -m 0 -O /tmp/mnt/sda1/logs/syslog.log -S -l 6 -s 15000 -b 10
logger -p NOTICE -t USBSYSLOGD \"USB syslogd logging started.\"
So I'm reaching out for some help here. All I want is the syslog to be on my USB at all times. Have it only log stuff greater than INFO. Stay within 15MB of space and rotate within 10 logs. I'm hoping someone here can help me discover what is going on.
Last edited: