summaryrefslogtreecommitdiff
path: root/scripts/system/vyatta_update_syslog.pl
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/system/vyatta_update_syslog.pl')
-rwxr-xr-xscripts/system/vyatta_update_syslog.pl21
1 files changed, 5 insertions, 16 deletions
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;
}