Skip to contentSkip to conversation

Busybox syslog tweaks

RFC PATCH New Joshua Lock 1 participant 6 messages Jan 11, 2012

lore
Share & tools
lore
#0 lore raw

cover Busybox syslog tweaks

This RFC series makes some minor changes to the configuration of busybox's syslog. The only one I think may be contentious, and why I've made this an RFC, is the 4th patch "busybox: change syslog default to log to a file" which changes the long-default behaviour.

Please review the following changes for suitability for inclusion. If you have any objections or suggestions for improvement, please respond to the patches. If you agree with the changes, please provide your Acked-by.

Cheers,
Joshua

The following changes since commit d5b8caac0e7fc4b05c76b4d3da0508e2a53f28cd:

package.bbclass: per recipe PRSERV_HOST support (2012-01-11 10:33:24 +0000)

are available in the git repository at:
git://git.openembedded.org/openembedded-core-contrib josh/syslog
http://cgit.openembedded.org/cgit.cgi/openembedded-core-contrib/log/?h=josh/syslog

Joshua Lock (5):
busybox: drop MARKINT option from init script and syslog-startup.conf
busybox: remove incorrect comments from syslog-startup.conf
busybox: enable log level configuration in syslog-startup.conf and
script
busybox: change syslog default to log to a file
busybox: enable dropping of duplicates in syslog, off by default

 meta/recipes-core/busybox/busybox-1.19.3/defconfig |    2 +-
 meta/recipes-core/busybox/busybox_1.19.3.bb        |    2 +-
 meta/recipes-core/busybox/files/syslog             |    9 ++++++---
 .../recipes-core/busybox/files/syslog-startup.conf |    9 +++++----
 4 files changed, 13 insertions(+), 9 deletions(-)
Signature · 1 line
1.7.7.5
#1 lore raw

RFC PATCH 1/5 busybox: drop MARKINT option from init script and syslog-startup.conf

This option has been disabled in busybox since 2007 as it was deemed too buggy. See:

http://git.busybox.net/busybox/commit/?id=4998c818919477d90674a3f220e7407c26da17f9

---
 meta/recipes-core/busybox/files/syslog             |    3 ---
 .../recipes-core/busybox/files/syslog-startup.conf |    1 -
 2 files changed, 0 insertions(+), 4 deletions(-)
meta/recipes-core/busybox/files/syslog +0 -3
index 5ff6599..0be412b 100644
@@ -37,9 +37,6 @@ if [ -f /etc/syslog-startup.conf ]; then
 	if [ "$LOG_LOCAL" = "1" -a "$LOG_REMOTE" = "1" ]; then
 		SYSLOG_ARGS="$SYSLOG_ARGS -L"
 	fi
-	if [ -n "$MARKINT" ]; then
-		SYSLOG_ARGS="$SYSLOG_ARGS -m $MARKINT"
-	fi
 	if [ "$REDUCE" = "yes" ]; then
 		SYSLOG_ARGS="$SYSLOG_ARGS -S"
 	fi
meta/recipes-core/busybox/files/syslog-startup.conf +0 -1
index 903a60c..1e4c559 100644
@@ -2,7 +2,6 @@
 # /etc/init.d/syslog[.busybox] to set syslog configuration at start time.
 
 DESTINATION=buffer		# log destinations (buffer file remote)
-MARKINT=20			# interval between --mark-- entries
 LOGFILE=/var/log/messages	# where to log (file)
 REMOTE=loghost:514		# where to log (syslog remote)
 REDUCE=no			# reduce-size logging
Signature · 1 line
1.7.7.5
#2 lore raw

RFC PATCH 2/5 busybox: remove incorrect comments from syslog-startup.conf

In reply to Joshua Lock

Setting rotation size and generations is supported with busybox syslogd

---
 .../recipes-core/busybox/files/syslog-startup.conf |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
meta/recipes-core/busybox/files/syslog-startup.conf +2 -2
index 1e4c559..f58cbe5 100644
@@ -5,7 +5,7 @@ DESTINATION=buffer		# log destinations (buffer file remote)
 LOGFILE=/var/log/messages	# where to log (file)
 REMOTE=loghost:514		# where to log (syslog remote)
 REDUCE=no			# reduce-size logging
-#ROTATESIZE=0			# rotate log if grown beyond X [kByte] (incompatible with busybox)
-#ROTATEGENS=3			# keep X generations of rotated logs (incompatible with busybox)
+#ROTATESIZE=0			# rotate log if grown beyond X [kByte]
+#ROTATEGENS=3			# keep X generations of rotated logs
 BUFFERSIZE=64			# size of circular buffer [kByte]
 FOREGROUND=no			# run in foreground (don't use!)
Signature · 1 line
1.7.7.5
#3 lore raw

RFC PATCH 3/5 busybox: enable log level configuration in syslog-startup.conf and script

In reply to Joshua Lock

It's possible to configure busybox syslog to only log messages above a certain level, expose this functionality through the syslog-startup.conf and syslog init script.

Valid values are 1-8 inclusive.

---
 meta/recipes-core/busybox/files/syslog             |    3 +++
 .../recipes-core/busybox/files/syslog-startup.conf |    1 +
 2 files changed, 4 insertions(+), 0 deletions(-)
meta/recipes-core/busybox/files/syslog +3 -0
index 0be412b..deeea8b 100644
@@ -40,6 +40,9 @@ if [ -f /etc/syslog-startup.conf ]; then
 	if [ "$REDUCE" = "yes" ]; then
 		SYSLOG_ARGS="$SYSLOG_ARGS -S"
 	fi
+	if [ -n "$LOGLEVEL" ]; then
+	    SYSLOG_ARGS="$SYSLOG_ARGS -l $LOGLEVEL"
+	fi
 else
 	# default: log to 16K shm circular buffer
 	SYSLOG_ARGS="-C"
meta/recipes-core/busybox/files/syslog-startup.conf +1 -0
index f58cbe5..83b86f2 100644
@@ -9,3 +9,4 @@ REDUCE=no			# reduce-size logging
 #ROTATEGENS=3			# keep X generations of rotated logs
 BUFFERSIZE=64			# size of circular buffer [kByte]
 FOREGROUND=no			# run in foreground (don't use!)
+#LOGLEVEL=5			# local log level (between 1 and 8)
Signature · 1 line
1.7.7.5
#4 lore raw

RFC PATCH 4/5 busybox: change syslog default to log to a file

In reply to Joshua Lock

This changes the default in syslog-startup.conf to log messages to a file (/var/log/messages) because:

a) we already mount /var/log as a volatile mount by default
b) users are accustomed to looking at /var/log/messages as most distributions don't ship with logread

---
 .../recipes-core/busybox/files/syslog-startup.conf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
meta/recipes-core/busybox/files/syslog-startup.conf +1 -1
index 83b86f2..553490b 100644
@@ -1,7 +1,7 @@
 # This configuration file is used by the busybox syslog init script,
 # /etc/init.d/syslog[.busybox] to set syslog configuration at start time.
 
-DESTINATION=buffer		# log destinations (buffer file remote)
+DESTINATION=file		# log destinations (buffer file remote)
 LOGFILE=/var/log/messages	# where to log (file)
 REMOTE=loghost:514		# where to log (syslog remote)
 REDUCE=no			# reduce-size logging
Signature · 1 line
1.7.7.5
#5 lore raw

RFC PATCH 5/5 busybox: enable dropping of duplicates in syslog, off by default

In reply to Joshua Lock

Busybox syslog includes functionality to drop duplicated syslog entries, enable this feature in the defconfig yet disable it by default.

Expose configuration of the feature through the syslog-startup.conf file and the syslog init script.

---
 meta/recipes-core/busybox/busybox-1.19.3/defconfig |    2 +-
 meta/recipes-core/busybox/busybox_1.19.3.bb        |    2 +-
 meta/recipes-core/busybox/files/syslog             |    3 +++
 .../recipes-core/busybox/files/syslog-startup.conf |    1 +
 4 files changed, 6 insertions(+), 2 deletions(-)
meta/recipes-core/busybox/busybox-1.19.3/defconfig +1 -1
index 1990f28..cd2a2ad 100644
@@ -997,7 +997,7 @@ CONFIG_FEATURE_SH_HISTFILESIZE=y
 CONFIG_SYSLOGD=y
 CONFIG_FEATURE_ROTATE_LOGFILE=y
 CONFIG_FEATURE_REMOTE_LOG=y
-# CONFIG_FEATURE_SYSLOGD_DUP is not set
+CONFIG_FEATURE_SYSLOGD_DUP=y
 CONFIG_FEATURE_SYSLOGD_CFG=y
 CONFIG_FEATURE_SYSLOGD_READ_BUFFER_SIZE=256
 CONFIG_FEATURE_IPC_SYSLOG=y
meta/recipes-core/busybox/busybox_1.19.3.bb +1 -1
index f591856..a075407 100644
@@ -1,5 +1,5 @@
 require busybox.inc
-PR = "r2"
+PR = "r3"
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://udhcpscript.patch \
meta/recipes-core/busybox/files/syslog +3 -0
index deeea8b..2944d3d 100644
@@ -40,6 +40,9 @@ if [ -f /etc/syslog-startup.conf ]; then
 	if [ "$REDUCE" = "yes" ]; then
 		SYSLOG_ARGS="$SYSLOG_ARGS -S"
 	fi
+	if [ "$DROPDUPLICATES" = "yes" ]; then
+	    SYSLOG_ARGS="$SYSLOG_ARGS -D"
+	fi
 	if [ -n "$LOGLEVEL" ]; then
 	    SYSLOG_ARGS="$SYSLOG_ARGS -l $LOGLEVEL"
 	fi
meta/recipes-core/busybox/files/syslog-startup.conf +1 -0
index 553490b..fda450a 100644
@@ -5,6 +5,7 @@ DESTINATION=file		# log destinations (buffer file remote)
 LOGFILE=/var/log/messages	# where to log (file)
 REMOTE=loghost:514		# where to log (syslog remote)
 REDUCE=no			# reduce-size logging
+DROPDUPLICATES=no		# whether to drop duplicate log entries
 #ROTATESIZE=0			# rotate log if grown beyond X [kByte]
 #ROTATEGENS=3			# keep X generations of rotated logs
 BUFFERSIZE=64			# size of circular buffer [kByte]
Signature · 1 line
1.7.7.5