From 93fcb8164f1b86b43ed7cb3cb65f2d634a46b1c5 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 6 May 2009 16:47:46 -0700 Subject: Allow specifying 'protocols' for syslog facility Since quagga uses local7, make it a real facility. Allow local7 for compatiablity. Bug 4263 --- scripts/system/vyatta_update_syslog.pl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'scripts') diff --git a/scripts/system/vyatta_update_syslog.pl b/scripts/system/vyatta_update_syslog.pl index 49662c30..534c9b77 100755 --- a/scripts/system/vyatta_update_syslog.pl +++ b/scripts/system/vyatta_update_syslog.pl @@ -43,6 +43,12 @@ sub add_entry { push @{ $entries{$target} }, $selector; } +# This allows overloading local values in CLI +my %facmap = ( + 'all' => '*', + 'protocols' => 'local7', +); + # This builds a data structure that maps from target # to selector list for that target sub read_config { @@ -50,8 +56,8 @@ sub read_config { foreach my $facility ( $config->listNodes("$level facility") ) { my $loglevel = $config->returnValue("$level facility $facility level"); - $facility = '*' if ( $facility eq 'all' ); - $loglevel = '*' if ( $loglevel eq 'all' ); + $facility = $facmap{$facility} if ( $facmap{$facility} ); + $loglevel = '*' if ( $loglevel eq 'all' ); add_entry( $facility . '.' . $loglevel, $target ); } -- cgit v1.2.3 From c412935a4a66cbdc26d7a8a24a17621612eafc9e Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Wed, 6 May 2009 17:20:25 -0700 Subject: Reindent syslog script --- scripts/system/vyatta_update_syslog.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'scripts') diff --git a/scripts/system/vyatta_update_syslog.pl b/scripts/system/vyatta_update_syslog.pl index 534c9b77..83fa9576 100755 --- a/scripts/system/vyatta_update_syslog.pl +++ b/scripts/system/vyatta_update_syslog.pl @@ -45,8 +45,8 @@ sub add_entry { # This allows overloading local values in CLI my %facmap = ( - 'all' => '*', - 'protocols' => 'local7', + 'all' => '*', + 'protocols' => 'local7', ); # This builds a data structure that maps from target @@ -56,8 +56,8 @@ sub read_config { foreach my $facility ( $config->listNodes("$level facility") ) { my $loglevel = $config->returnValue("$level facility $facility level"); - $facility = $facmap{$facility} if ( $facmap{$facility} ); - $loglevel = '*' if ( $loglevel eq 'all' ); + $facility = $facmap{$facility} if ( $facmap{$facility} ); + $loglevel = '*' if ( $loglevel eq 'all' ); add_entry( $facility . '.' . $loglevel, $target ); } @@ -90,7 +90,8 @@ foreach my $user ( $config->listNodes('user') ) { if ( -r $SYSLOG_CONF ) { system("sed -e '/$BEGIN_VYATTA/,/$END_VYATTA/d' <$SYSLOG_CONF >$SYSLOG_TMP") - == 0 or die "Can't read $SYSLOG_CONF"; + == 0 + or die "Can't read $SYSLOG_CONF"; } open my $out, '>>', $SYSLOG_TMP -- cgit v1.2.3