From 3595c131e9d438a6ad159d6b43db05d9e5bc4e13 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Fri, 13 Jul 2012 15:17:37 -0700 Subject: Fix syslog level for commit messages Bug 8208 The log level should be notice not alert. Also, the script doesn't depend on anything in Vyatta config or other Vyatta perl libaries. --- scripts/vyatta-log-commit.pl | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/scripts/vyatta-log-commit.pl b/scripts/vyatta-log-commit.pl index e7e38b2..bbf0852 100644 --- a/scripts/vyatta-log-commit.pl +++ b/scripts/vyatta-log-commit.pl @@ -26,33 +26,25 @@ # Description: Script to log active configuration commits to syslog. # # **** End License **** -# - use strict; use warnings; -use lib '/opt/vyatta/share/perl5/'; -use Vyatta::Config; use Sys::Syslog qw(:standard :macros); use POSIX qw(ttyname); # # main # -my $commit_status; -my $cur_tty = ttyname(0); -my $cur_user = getlogin() || getpwuid($<) || "unknown"; my $status = $ENV{'COMMIT_STATUS'}; - -chomp($cur_tty); -chomp($cur_user); - -$commit_status = 'Successful' if ($status eq 'SUCCESS'); +my $commit_status = 'Successful' if ($status eq 'SUCCESS'); #open log for logging commit details if (defined $commit_status) { - openlog("commit", "", LOG_USER); - syslog ("alert", "$commit_status change to active configuration by user $cur_user on $cur_tty"); - closelog(); + my $cur_tty = ttyname(0); + my $cur_user = getlogin() || getpwuid($<) || "unknown"; + + openlog("commit", "", LOG_USER); + syslog (LOG_NOTICE, "$commit_status change to active configuration by user $cur_user on $cur_tty"); + closelog(); } #end of script -- cgit v1.2.3