What's new

SysLog to USB Issues

  • SNBForums Code of Conduct

    SNBForums is a community for everyone, no matter what their level of experience.

    Please be tolerant and patient of others, especially newcomers. We are all here to share and learn!

    The rules are simple: Be patient, be nice, be helpful or be gone!

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

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:
No one really? Well in any case. After some trial and effort it seems the following code sort of works. Allows me to see the system log information that gets done before post-mount by appending it. That way I don't miss any information when the syslog gets moved to usb. Seems it works okay for the most part with the system log viewer as well. Not seeing an issue where it doesn't display; for now that is.

I wish there was an option within the GUI that allowed you to move the syslog to a location and specify the amount of KB and log rotations. There is one already for the traffic monitoring that allows you to specify a custom location, would be cool if you could do the same for the syslog.


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.\"
 
Last edited:

Similar threads

Latest threads

Sign Up For SNBForums Daily Digest

Get an update of what's new every day delivered to your mailbox. Sign up here!
Top