summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-10-08 17:11:30 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-10-08 17:11:30 -0700
commit8c76eecf50f943b0a7e759f398f6d16dac53dac0 (patch)
treefd3994149511fed21d09d2ff5ec2b3339535e5f1
parentcbc9578ade6afaf6db039401182b6cfe14e73ff9 (diff)
downloadvyatta-cfg-quagga-8c76eecf50f943b0a7e759f398f6d16dac53dac0.tar.gz
vyatta-cfg-quagga-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
-rw-r--r--Makefile.am2
-rw-r--r--debian/vyatta-cfg-system.postinst.in14
-rwxr-xr-xscripts/system/vyatta_update_logrotate.pl11
-rwxr-xr-xscripts/system/vyatta_update_syslog.pl21
-rw-r--r--sysconf/rsyslog.conf46
-rw-r--r--sysconf/syslog.conf12
-rw-r--r--templates/system/syslog/node.def2
7 files changed, 61 insertions, 47 deletions
diff --git a/Makefile.am b/Makefile.am
index 0502fcb4..338e53b4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -72,7 +72,7 @@ sysconf_DATA += sysconf/logrotate_messages
sysconf_DATA += sysconf/issue
sysconf_DATA += sysconf/issue.net
sysconf_DATA += sysconf/motd.tail
-sysconf_DATA += sysconf/syslog.conf
+sysconf_DATA += sysconf/rsyslog.conf
sysconf_DATA += sysconf/ntp.conf
sysconf_DATA += sysconf/default_ssh
sysconf_DATA += sysconf/securetty
diff --git a/debian/vyatta-cfg-system.postinst.in b/debian/vyatta-cfg-system.postinst.in
index daecb83f..8d288e75 100644
--- a/debian/vyatta-cfg-system.postinst.in
+++ b/debian/vyatta-cfg-system.postinst.in
@@ -129,6 +129,11 @@ EOF
# Install pam_cap config
cp $sysconfdir/capability.conf /etc/security/capability.conf
+
+ # Install our own version of rsyslog.conf without
+ # default targets
+ mv /etc/rsyslog.conf /etc/rsyslog.conf.orig
+ cp $sysconfdir/rsyslog.conf /etc/rsyslog.conf
fi
# create needed directories
@@ -177,15 +182,6 @@ if [ -e /etc/default/mdadm ]; then
sed -i 's+^DAEMON_OPTIONS=.*$+DAEMON_OPTIONS="--syslog --program /opt/vyatta/sbin/vyatta-raid-event"+' /etc/default/mdadm
fi
-# --following is added to resolve issues related to bug 3567 on upgrade from hollywood to islavista--
-# back-up existing /etc/syslog.conf file in hollywood which might be broken
-# and replace it with the default syslog.conf in islavista. when system restarts
-# after upgrade, whatever is configured in CLI will be written to syslog.conf
-#
-
-cp -p /etc/syslog.conf /etc/syslog.conf.bak
-cp -f /opt/vyatta/etc/syslog.conf /etc/syslog.conf
-
# remove unnecessary ddclient script in /etc/ppp/ip-up.d/
# this logs unnecessary messages trying to start ddclient
rm -f /etc/ppp/ip-up.d/ddclient
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;
}
diff --git a/sysconf/rsyslog.conf b/sysconf/rsyslog.conf
new file mode 100644
index 00000000..9d767d90
--- /dev/null
+++ b/sysconf/rsyslog.conf
@@ -0,0 +1,46 @@
+# /etc/rsyslog.conf Configuration file for rsyslog.
+#
+# For more information see
+# /usr/share/doc/rsyslog-doc/html/rsyslog_conf.html
+
+
+#################
+#### MODULES ####
+#################
+
+$ModLoad imuxsock # provides support for local system logging
+$ModLoad imklog # provides kernel logging support (previously done by rklogd)
+#$ModLoad immark # provides --MARK-- message capability
+
+# provides UDP syslog reception
+#$ModLoad imudp
+#$UDPServerRun 514
+
+# provides TCP syslog reception
+#$ModLoad imtcp
+#$InputTCPServerRun 514
+
+
+###########################
+#### GLOBAL DIRECTIVES ####
+###########################
+
+#
+# Use traditional timestamp format.
+# To enable high precision timestamps, comment out the following line.
+#
+$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
+
+#
+# Set the default permissions for all log files.
+#
+$FileOwner root
+$FileGroup adm
+$FileCreateMode 0640
+$DirCreateMode 0755
+$Umask 0022
+
+#
+# Include all config files in /etc/rsyslog.d/
+#
+$IncludeConfig /etc/rsyslog.d/*.conf
diff --git a/sysconf/syslog.conf b/sysconf/syslog.conf
deleted file mode 100644
index 2f443198..00000000
--- a/sysconf/syslog.conf
+++ /dev/null
@@ -1,12 +0,0 @@
-# /etc/syslog.conf Configuration file for syslogd.
-#
-# For more information see syslog.conf(5)
-# manpage.
-#
-# WARNING
-
-# The following are modified Vyatta Fusion CLI related configuration
-# any changes outside CLI will be lost
-### BEGIN VYATTA
-*.notice;local7.* -/var/log/messages
-### END VYATTA
diff --git a/templates/system/syslog/node.def b/templates/system/syslog/node.def
index 91c1295b..bf6ef233 100644
--- a/templates/system/syslog/node.def
+++ b/templates/system/syslog/node.def
@@ -1,5 +1,5 @@
priority: 400
help: System logging daemon
end: if /opt/vyatta/sbin/vyatta_update_syslog.pl; then
- sudo /usr/sbin/invoke-rc.d sysklogd reload
+ sudo /usr/sbin/invoke-rc.d rsyslog reload
fi