diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-10-08 17:11:30 -0700 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-10-08 17:11:30 -0700 |
commit | 8c76eecf50f943b0a7e759f398f6d16dac53dac0 (patch) | |
tree | fd3994149511fed21d09d2ff5ec2b3339535e5f1 /scripts | |
parent | cbc9578ade6afaf6db039401182b6cfe14e73ff9 (diff) | |
download | vyatta-cfg-system-8c76eecf50f943b0a7e759f398f6d16dac53dac0.tar.gz vyatta-cfg-system-8c76eecf50f943b0a7e759f398f6d16dac53dac0.zip |
Convert from syslog to rsyslog
Configuration file is /etc/rsyslog.conf and it is supports
directory of include parameters so do not need to edit
rsyslog.conf directly
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/system/vyatta_update_logrotate.pl | 11 | ||||
-rwxr-xr-x | scripts/system/vyatta_update_syslog.pl | 21 |
2 files changed, 8 insertions, 24 deletions
diff --git a/scripts/system/vyatta_update_logrotate.pl b/scripts/system/vyatta_update_logrotate.pl index d7649496..6e5c20cd 100755 --- a/scripts/system/vyatta_update_logrotate.pl +++ b/scripts/system/vyatta_update_logrotate.pl @@ -35,17 +35,12 @@ $log_file { rotate $files size=${size}k postrotate - kill -HUP `cat /var/run/syslogd.pid` + kill -HUP `cat /var/run/rsyslogd.pid` endscript } EOF } close $out; -sleep 1; -if (system("/usr/sbin/invoke-rc.d sysklogd restart")) { - exit 4; -} - -exit 0; - +exec '/usr/sbin/invoke-rc.d', 'rsyslog', 'restart'; +exit 4; diff --git a/scripts/system/vyatta_update_syslog.pl b/scripts/system/vyatta_update_syslog.pl index 8047999d..1c4c6d46 100755 --- a/scripts/system/vyatta_update_syslog.pl +++ b/scripts/system/vyatta_update_syslog.pl @@ -16,7 +16,7 @@ # # **** End License **** -# Update /etc/syslog.conf +# Update /etc/rsyslog.d/vyatta-log.conf # Exit code: 0 - update # 1 - no change or error @@ -25,12 +25,10 @@ use lib "/opt/vyatta/share/perl5"; use Vyatta::Config; use File::Compare; -my $SYSLOG_CONF = '/etc/syslog.conf'; -my $SYSLOG_TMP = "/tmp/syslog.conf.$$"; +my $SYSLOG_CONF = '/etc/rsyslog.d/vyatta-log.conf'; +my $SYSLOG_TMP = "/tmp/rsyslog.conf.$$"; my $MESSAGES = '-/var/log/messages'; my $CONSOLE = '/dev/console'; -my $BEGIN_VYATTA = '### BEGIN VYATTA'; -my $END_VYATTA = '### END VYATTA'; my %entries = (); @@ -88,26 +86,17 @@ foreach my $user ( $config->listNodes('user') ) { read_config( $config, 'user $user', $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"; -} - -open my $out, '>>', $SYSLOG_TMP +open my $out, '>', $SYSLOG_TMP or die "Can't open $SYSLOG_TMP: $!"; -print $out "$BEGIN_VYATTA\n"; - foreach my $target ( keys %entries ) { print $out join( ';', @{ $entries{$target} } ), "\t$target\n"; } -print $out "$END_VYATTA\n"; close $out or die "Can't output $SYSLOG_TMP: $!"; # Don't need to do anything, save time on boot -if ( compare( $SYSLOG_CONF, $SYSLOG_TMP ) == 0 ) { +if ( -e $SYSLOG_CONF && compare( $SYSLOG_CONF, $SYSLOG_TMP ) == 0 ) { unlink($SYSLOG_TMP); exit 1; } |