Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 3 Nov 2006 21:31:59 -0500 (EST)
From:      "Brian A. Seklecki" <lavalamp@spiritual-machines.org>
To:        freebsd-ports@freebsd.org
Cc:        syslog-ng@lists.balabit.hu, Vivek Khera <vivek@khera.org>, bseklecki@collaborativefusion.com
Subject:   sysutils/syslog-ng/files/syslong-ng.sh.in patch
Message-ID:  <20061103203811.T92133@arbitor.digitalfreaks.org>

next in thread | raw e-mail | index | archive | help

This is a nice little patch we use to purge out /dev/klog after 
/etc/rc.d/dmesg and before /usr/local/etc/rc.d/syslog-ng.sh.

It's useful for shops that translate user.info facility/priority syslog 
messages into SMS/E-Mail via a log{} mechanism (i.e., hardware error 
messages from the kernel, like some flunky in the NOC plugging a keyboard 
into your system).

It lets you avoid 200 lines of boot messages in log(9) making their way 
into your log{} mechanism or into your pager.

We want to feed it upstream because we think others will find it useful.

~BAS

$ diff -u /usr/ports/sysutils/syslog-ng/files/syslog-ng.sh.in 
syslog-ng.sh.in

--- /usr/ports/sysutils/syslog-ng/files/syslog-ng.sh.in Wed Mar 29 
16:20:19 2006
+++ syslog-ng.sh.in     Fri Nov  3 20:32:59 2006
@@ -14,6 +14,8 @@
  #syslog_ng_enable="YES"
  #

+syslog_ng_purgeklog=${syslog_ng_purgeklig-"NO"}
+
  . %%RC_SUBR%%

  name=syslog_ng
@@ -23,6 +25,11 @@
  required_files=%%PREFIX%%/etc/syslog-ng/syslog-ng.conf
  pidfile=/var/run/syslog.pid
  extra_commands=reload
+
+if checkyesno syslog_ng_purgeklog; then
+        start_precmd="echo \"Purging klog(9)\" && sysctl -w 
kern.msgbuf_clear=1 $start_precmd";
+fi
+
  stop_postcmd=stop_postcmd

  load_rc_config $name

----

l8*
 	-lava (Brian A. Seklecki - Pittsburgh, PA, USA)
 	       http://www.spiritual-machines.org/

"...from back in the heady days when "helpdesk" meant nothing, "diskquota"
meant everything, and lives could be bought and sold for a couple of pages
of laser printout - and frequently were."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061103203811.T92133>