May 21, 200818 yr I suggest that unRAID automatically copy the syslog to the unRAID USB stick on shutdown. It should keep a history of the past 5. Experienced users only shutdown their arrays a few times a month, so the wear and tear on the drive would be minimal. New users often lose the opportunity to capture it, resulting in mysteries that sometimes undermine unRAID.
May 21, 200818 yr Actually the logrotate procedure needs to be part of this too. I had worked on a script to automate all of this. I'm just waiting to see Tom's response on the proposal of unraid runlevels because part of this would be within those runlevels. Here is what I came up with so far. I think the addition to logrotate.conf needs to be updated. I have not reviewed this in a while. I was thinking of zipping the log too. So you would have a txt version and a zip version for uploading. #!/bin/sh # Reads syslog converts to dos, saves syslog to OUTPUT_DIR as OUTPUT if [ "${DEBUG:=0}" -gt 0 ] then set -x -v fi P=${0##*/} # basename of program R=${0%%$P} # dirname of program P=${P%.*} # strip off after last . character O=${P%_*} # Operand D=${P#${O}_} # Data (last param before _ character) SAVE_ROTATE="yes" # Move under other line to save syslogs on rotation SAVE_ROTATE="no" INPUT=/var/log/syslog OUTPUT="syslog-`date -r ${INPUT} +'%Y%m%d-%k%M'`.txt" OUTPUT_DIR=/boot/var/log OUTPUT_DIR=/boot/logs # Normally we can use $0 if called with a full pathname. # in my environment it is called with <fromdos $0 | sh # so I have to use the full program/pathname for this program # change to suite your taste THISPROG=$0 THISPROG=/boot/config/rc.local/S99-syslog-save # Insure output directory exists if [ ! -d ${OUTPUT_DIR} ] then mkdir -p ${OUTPUT_DIR} fi # No size to input, skip if [ ! -s ${INPUT} ] then exit fi # Remove logs from OUTPUT_DIR > 7 days find ${OUTPUT_DIR} -mtime +7 -name "syslog*.txt" -exec rm {} \; # convert input to dos for dos machines via samba todos < ${INPUT} >> ${OUTPUT_DIR}/${OUTPUT} # save modification time to be same as original touch -r ${INPUT} ${OUTPUT_DIR}/${OUTPUT} # set perms for unhidden and readable chmod 666 ${OUTPUT_DIR}/${OUTPUT} # if save files via daily rotation, set variable above to yes # This puts a call to this script in the pre-rotate section for /var/log/syslog # if [ "${SAVE_ROTATE}" != "yes" ] then exit fi # upon first invocation if call to this script not present # and saving of syslogs on rotation if selected if ! grep ${THISPROG} /etc/logrotate.conf > /dev/null 2>&1 then while read LINE do echo "${LINE}" if [ "${LINE}" = "/var/log/syslog {" ] then echo "prerotate" echo " ${THISPROG}" echo "endscript" fi done < /etc/logrotate.conf > /etc/logrotate.conf.tmp cat < /etc/logrotate.conf.tmp > /etc/logrotate.conf rm -f /etc/logrotate.conf.tmp fi
May 21, 200818 yr One ley element of any syslog system would be the abilty to activate real time log saving. Most people wouldnt want or need this but it is essential for users that are having full on system crashes.
May 21, 200818 yr If we had a capable web server this could all be handled under the hood. I.E. When needed re-write the syslog.conf file so it writes to flash. Or provide a button to copy to flash on demand. This script in particular, just saves the syslog on reboot or saves it anything the log is rotated. For me, I rewrite the syslog on bootup to send the syslog messages to a separate mini itx log host. All my machines log there with syslog-ng and populate a mysql database for review with php-syslog http://code.google.com/p/php-syslog-ng/ Veering off topic a lil, this is why I bought the GIGABYTE Ram Drive, so all logs and the database are now on a non moving battery backed ram drive. (Which is rsynced to a compact flash every hour). In any case, many possibilities exist, but everything hinges on the environment having a web server with CGI capability. I've though about using WEBMIN but it's not that lightweight either.
May 21, 200818 yr If we could find an authenticated syslig daemon we could allow forum users to collectively use it. The traffic would be minimal. Reaks of value aded feature for limetech or someone else.
May 21, 200818 yr Author The goal here is to have a default mechanism in place. If people have to install something it will not help. I started thinking that naybe an update to the mover script could be made to copy the syslog just before or just after copying the cache. Of course that only helps PRO users.
May 21, 200818 yr I agree there should be a default mechanism. 1. View on the user interface and allow downloading. 2. Save to key on shutdown, reboot or on demand. 3. Save rotated or daily log on key. My plugin script attempts to do 2 parts of #2 and 1 part of #3. As far as a daily copy of syslog to key. That's as simple as a cron job. I can add that to the script. Once again, I think I agree it should be default, but until then... we have scripts.
Archived
This topic is now archived and is closed to further replies.