[syslog-ng] sysutils/syslog-ng/files/syslong-ng.sh.in patch

Brian A. Seklecki lavalamp at spiritual-machines.org
Sat Nov 4 03:31:59 CET 2006


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."


More information about the syslog-ng mailing list