I'm running the May 2001 release of Oxygen, and I'm trying to get the system to email me the logs each day. I have ssmtp working from the command line, so that I can "ssmtp [EMAIL PROTECTED] < /var/log/kern.log" and the log shows up just fine.
However, I have two problems:
1) If the log I'm trying to send is large, I get a "ssmtp: Header too large Max is 4000 characters" error. Obviously, I need to do some pre-processing on the log files to define a header at the top of the file and put the log info in a defined "body" of the message. Since I'm new to linux, I don't know how to do this.
2) To automate the log sending process, I think I need to put something into /etc/cron.daily/multicron-d? Here's a chunk of multicron-d:
<snip>
rotatelogs () {
case $prog in
*-d ) LOGFILES=$lrp_LOGS_DAILY ;;
*-w ) LOGFILES=$lrp_LOGS_WEEKLY ;;
*-m ) LOGFILES=$lrp_LOGS_MONTHLY ;;
* ) return 1 ;;
esac
cd /var/log
for LOG in $LOGFILES; do
if [ -f $LOG ]; then
savelog -g adm -m 640 -u root -c ${lrp_LOGS_DEPTH:-4} $LOG >/dev/null
fi
done
svi sysklogd reload
}
<snip>
I think I need to insert a line above the "savelog" line to send the log files before they are rotated -- and, possibly, to do the pre-processing on the spot? But, again, I'm lost.
I'm not sure what the "right" way to solve these two problems is -- should I be trying to put code into multicron-d, or do I need to write a separate script? (I've never done that either)
Sorry for the simple questions!
Also, I notice the following further down in multicron-d. Is this going to work in Oxygen, with no defined mail command? Does -s mean anything to ssmtp?
<snip>
mailadmin () {
if [ "$lrp_MAIL_ADMIN" = "" ]; then
cat >/dev/null
else
subject="$HOSTNAME alert: $1"
mail -s "$subject" "$lrp_MAIL_ADMIN"
fi
}
<snip>
Thanks!
--Merrick Munday
