From owner-freebsd-questions Sat Oct 2 23:49: 1 1999 Delivered-To: freebsd-questions@freebsd.org Received: from cc942873-a.ewndsr1.nj.home.com (cc942873-a.ewndsr1.nj.home.com [24.2.89.207]) by hub.freebsd.org (Postfix) with ESMTP id 6D78F14E28 for ; Sat, 2 Oct 1999 23:48:59 -0700 (PDT) (envelope-from cjc@cc942873-a.ewndsr1.nj.home.com) Received: (from cjc@localhost) by cc942873-a.ewndsr1.nj.home.com (8.9.3/8.9.3) id CAA06090; Sun, 3 Oct 1999 02:51:55 -0400 (EDT) (envelope-from cjc) From: "Crist J. Clark" Message-Id: <199910030651.CAA06090@cc942873-a.ewndsr1.nj.home.com> Subject: Re: syslog and mailing logs In-Reply-To: <21DC5E98AE1FD311B1290020AFDB6C6E6460@DRIP> from river at "Oct 2, 1999 11:59:36 pm" To: river@theriver.nu (river) Date: Sun, 3 Oct 1999 02:51:55 -0400 (EDT) Cc: cjclark@home.com ('cjclark@home.com'), questions@FreeBSD.ORG Reply-To: cjclark@home.com X-Mailer: ELM [version 2.4ME+ PL54 (25)] MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG river wrote, > I.E in linux i can do the following with the log files: > > > /var/log/messages { > rotate 1 > size=10k > mail user@company.com > errors user@company.com > postrotate > /usr/bin/killall -HUP syslogd > endscript > } > > > I need to be able to do this in BSD Ahhh... From the looks of that config file, I would guess we are talking about a Red Hat utility. Ah, yes, logging onto a Red Hat system I have access to, I see that this is the 'logrotate' command's config file. The newsyslogd(8) command in FreeBSD does not have the built-in capability to send logs as email, it would be quite easy to create a shell script that does this for you. For example, #!/bin/sh # # mailsyslog # User(s) we wish to send log to RECP=user@company.com # Log file(s) we wish to send LOGS=/var/log/messages # Loop over the logs for LOG in $LOGS; do # We configured newsyslogd to create a .0 file of what # we want to mail. Check if this file exists. if [ -f "$LOG".0 ]; then # Send it mail -s "$LOG at $HOST" $RECP < "$LOG".0 # Sent, delete it (we could compress it or something if we # did not want to delete it). rm "$LOG".0 fi done After you have put the script someplace like, /usr/local/libexec, you edit the /etc/crontab file so it is run right after newsyslogd. Edit the newsyslogd line like, # rotate log files every hour, if necessary 0 * * * * root newsyslog; /usr/local/libexec/mailsyslog That looks like it would do what you want. OTOH, Red Hat's logrotate would likely run on a FreeBSD system... -- Crist J. Clark cjclark@home.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message