diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2009-04-06 21:32:29 -0700 |
---|---|---|
committer | Stephen Hemminger <shemminger@vyatta.com> | 2009-04-08 15:33:37 -0700 |
commit | 3f6410042b54db636eac390657a8a35583515ce4 (patch) | |
tree | 53d912db2b97adce4ac22f09abd4686a305885b5 /templates/system/syslog | |
parent | b565e19b831a92a054e9281624f51482d3d9566e (diff) | |
download | vyatta-cfg-system-3f6410042b54db636eac390657a8a35583515ce4.tar.gz vyatta-cfg-system-3f6410042b54db636eac390657a8a35583515ce4.zip |
Rewrite existing syslog configuration update
Do most of the work in the rewritten vyatta_update_syslog code.
Handle multiple facilities for same target without causing duplicate
log messages.
Never restart syslog daemon, just reload it and only if the configuration
has changed.
Diffstat (limited to 'templates/system/syslog')
-rw-r--r-- | templates/system/syslog/console/facility/node.def | 8 | ||||
-rw-r--r-- | templates/system/syslog/file/node.def | 6 | ||||
-rw-r--r-- | templates/system/syslog/file/node.tag/facility/node.def | 9 | ||||
-rw-r--r-- | templates/system/syslog/global/facility/node.def | 10 | ||||
-rw-r--r-- | templates/system/syslog/host/node.tag/facility/node.def | 8 | ||||
-rw-r--r-- | templates/system/syslog/node.def | 11 | ||||
-rw-r--r-- | templates/system/syslog/user/node.tag/facility/node.def | 8 |
7 files changed, 7 insertions, 53 deletions
diff --git a/templates/system/syslog/console/facility/node.def b/templates/system/syslog/console/facility/node.def index f505610d..4a565f6e 100644 --- a/templates/system/syslog/console/facility/node.def +++ b/templates/system/syslog/console/facility/node.def @@ -2,14 +2,6 @@ tag: type: txt help: Set facility for console logging syntax:expression: $VAR(@) in "auth", "authpriv", "cron", "daemon", "kern", "lpr", "mail", "mark", "news", "security", "syslog", "user", "uucp", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7", "all"; "\"$VAR(@)\" is not a valid logging facility" -create:expression: "sudo sh -c \"LVL=`echo -n $VAR(level/@) | tr '[a-z]' '[A-Z]'` && \ -FAC='$VAR(@)' ; if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\\" \ - '\\/dev\\/console' \\\"\\$FAC.\\$LVL\t/dev/console\n\\\"\" " -delete:expression: "sudo sh -c \"FAC='$VAR(@)' ; \ -if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\\" \ - '\\/dev\\/console' ''\" " comp_help:Available logging facilities: all All facilities excluding "mark" auth Authentication and authorization diff --git a/templates/system/syslog/file/node.def b/templates/system/syslog/file/node.def index 5486c136..2ff7e359 100644 --- a/templates/system/syslog/file/node.def +++ b/templates/system/syslog/file/node.def @@ -1,5 +1,7 @@ tag: type: txt help: Set the name of syslog file to save log messages to -syntax:expression: pattern $VAR(@) "^[-a-zA-Z0-9_.]+$" ; "invalid file name $VAR(@)" -commit:expression: $VAR(./@/facility/@@) != ""; "At least one facility must be configured to log messages to file $VAR(./@)" +syntax:expression: pattern $VAR(@) "^\/" ; "File name must be full pathname with leading /" +commit:expression: $VAR(./@/facility/@@) != ""; \ + "At least one facility must be configured to log messages to file $VAR(./@)" +comp_help: Full path name of log file with leading slash diff --git a/templates/system/syslog/file/node.tag/facility/node.def b/templates/system/syslog/file/node.tag/facility/node.def index b9279085..f793e9b4 100644 --- a/templates/system/syslog/file/node.tag/facility/node.def +++ b/templates/system/syslog/file/node.tag/facility/node.def @@ -2,15 +2,6 @@ tag: type: txt help: Set facility for file logging syntax:expression: $VAR(@) in "auth", "authpriv", "cron", "daemon", "kern", "lpr", "mail", "mark", "news", "security", "syslog", "user", "uucp", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7", "all"; "\"$VAR(@)\" is not a valid logging facility" -create:expression: "sudo sh -c \"LVL=`echo -n $VAR(level/@) | tr '[a-z]' '[A-Z]'` && \ -FAC='$VAR(@)' ; if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\\" \ - '\\/var\\/log\\/user\\/$VAR(../@)' \ - \\\"\\$FAC.\\$LVL\t/var/log/user/$VAR(../@) \n\\\"\" " -delete:expression: "sudo sh -c \"FAC='$VAR(@)' ; \ -if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\\" \ - '\\/var\\/log\\/user\\/$VAR(../@)' ''\" " comp_help:Available logging facilities: all All facilities excluding "mark" auth Authentication and authorization diff --git a/templates/system/syslog/global/facility/node.def b/templates/system/syslog/global/facility/node.def index d3ee692d..0616179f 100644 --- a/templates/system/syslog/global/facility/node.def +++ b/templates/system/syslog/global/facility/node.def @@ -1,15 +1,7 @@ tag: type: txt help: Set facility for system logging -syntax:expression: $VAR(@) in "auth", "authpriv", "cron", "daemon", "kern", "lpr", "mail", "mark", "news", "security", "syslog", "user", "uucp", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7", "all"; "\"$VAR(@)\" is not a valid logging facility" -create:expression: "sudo sh -c \"LVL=`echo -n $VAR(level/@) | tr '[a-z]' '[A-Z]'` && \ -FAC='$VAR(@)' ; if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\\" '\\/var\\/log\\/messages' \ - \\\"\\$FAC.\\$LVL\t-/var/log/messages \n\\\"\" " -delete:expression: "sudo sh -c \"FAC='$VAR(@)' ; \ -if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \ - \\\"\\$FAC\\.\\\" '\\/var\\/log\\/messages' ''\" " +syntax:expression: $VAR(@) in "auth", "authpriv", "cron", "daemon", "kern", "lpr", "mail", "mark", "news", "security", "syslog", "user", "uucp", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7", "all" ; "\"$VAR(@)\" is not a valid logging facility" comp_help:Available logging facilities: all All facilities excluding "mark" auth Authentication and authorization diff --git a/templates/system/syslog/host/node.tag/facility/node.def b/templates/system/syslog/host/node.tag/facility/node.def index 32099823..ba18add0 100644 --- a/templates/system/syslog/host/node.tag/facility/node.def +++ b/templates/system/syslog/host/node.tag/facility/node.def @@ -2,14 +2,6 @@ tag: type: txt help: Set facility for host logging syntax:expression: $VAR(@) in "auth", "authpriv", "cron", "daemon", "kern", "lpr", "mail", "mark", "news", "security", "syslog", "user", "uucp", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7", "all"; "\"$VAR(@)\" is not a valid logging facility" -create:expression: "sudo sh -c \"LVL=`echo -n $VAR(level/@) | tr '[a-z]' '[A-Z]'` && \ -FAC='$VAR(@)' ; if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\\" '@$VAR(../@) ' \ - \\\"\\$FAC.\\$LVL\t@$VAR(../@) \n\\\"\" " -delete:expression: "sudo sh -c \"FAC='$VAR(@)' ; \ -if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\\" \ - '@$VAR(../@) ' ''\" " comp_help:Available logging facilities: all All facilities excluding "mark" auth Authentication and authorization diff --git a/templates/system/syslog/node.def b/templates/system/syslog/node.def index 6bca3490..9e3254e1 100644 --- a/templates/system/syslog/node.def +++ b/templates/system/syslog/node.def @@ -1,11 +1,4 @@ help: Configure syslog daemon -end: if [ -n "$VAR(./global/facility/@@)" ]; then - # remove the default config for global messages - sudo sh -c "sed -i '/\*\.notice;local7\.\*[[:space:]]*-\/var\/log\/messages/d' /etc/syslog.conf" - else - # if not already there then write the default config for global messages - if ! grep -q "\*\.notice;local7\.\*[[:space:]]*-/var/log/messages" /etc/syslog.conf; then - sudo sh -c "echo \"*.notice;local7.* -/var/log/messages\" >> /etc/syslog.conf" - fi +end: if /opt/vyatta/sbin/vyatta_update_syslog.pl; then + sudo /usr/sbin/invoke-rc.d sysklogd reload fi - sudo /usr/sbin/invoke-rc.d sysklogd restart diff --git a/templates/system/syslog/user/node.tag/facility/node.def b/templates/system/syslog/user/node.tag/facility/node.def index 378671da..0d323521 100644 --- a/templates/system/syslog/user/node.tag/facility/node.def +++ b/templates/system/syslog/user/node.tag/facility/node.def @@ -2,14 +2,6 @@ tag: type: txt help: Set facility for user logging syntax:expression: $VAR(@) in "auth", "authpriv", "cron", "daemon", "kern", "lpr", "mail", "mark", "news", "security", "syslog", "user", "uucp", "local0", "local1", "local2", "local3", "local4", "local5", "local6", "local7", "all"; "\"$VAR(@)\" is not a valid logging facility" -create:expression: "sudo sh -c \"LVL=`echo -n $VAR(level/@) | tr '[a-z]' '[A-Z]'` && \ -FAC='$VAR(@)' ; if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\$LVL\\\" \ - ' $VAR(../@) ' \\\"\\$FAC.\\$LVL $VAR(../@) \n\\\"\" " -delete:expression: "sudo sh -c \"LVL=`echo -n $VAR(level/@) | tr '[a-z]' '[A-Z]'` && \ -FAC='$VAR(@)' ; if [ x\\$FAC == xall ]; then FAC='*'; fi && \ -/opt/vyatta/sbin/vyatta_update_syslog.pl \\\"\\$FAC\\.\\$LVL\\\" \ - ' $VAR(../@) ' ''\" " comp_help:Available logging facilities: all All facilities excluding "mark" auth Authentication and authorization |