From 2415dea5aa5ecc1542b3da7795c0b7c49b98f259 Mon Sep 17 00:00:00 2001 From: James Davidson Date: Thu, 5 Apr 2012 17:52:08 -0700 Subject: Use rsyslog to trigger log rotation The previous implementation of log rotation used an hourly cron job to check log file size and possibly perform a rotation. If the logging rate is high, this interval may allow for root file system space exhustion. Utilizing rsyslog's outchannel mechanism enables log rotation to be initiated as soon as the log file becomes larger than its configured size. Fixes Bug 7807. --- templates/system/syslog/file/node.tag/archive/files/node.def | 4 ---- templates/system/syslog/file/node.tag/archive/node.def | 3 +-- templates/system/syslog/file/node.tag/archive/size/node.def | 4 ---- templates/system/syslog/global/archive/files/node.def | 4 ---- templates/system/syslog/global/archive/node.def | 4 ---- templates/system/syslog/global/archive/size/node.def | 4 ---- templates/system/syslog/node.def | 2 +- 7 files changed, 2 insertions(+), 23 deletions(-) (limited to 'templates/system') diff --git a/templates/system/syslog/file/node.tag/archive/files/node.def b/templates/system/syslog/file/node.tag/archive/files/node.def index 09eea916..bb60506c 100644 --- a/templates/system/syslog/file/node.tag/archive/files/node.def +++ b/templates/system/syslog/file/node.tag/archive/files/node.def @@ -3,7 +3,3 @@ type: u32 help: Number of saved files default: 5 - -update: - sudo sh -c "/opt/vyatta/sbin/vyatta_update_logrotate.pl \ - '$VAR(../../@)' '$VAR(@)' '$VAR(../size/@)' 1" diff --git a/templates/system/syslog/file/node.tag/archive/node.def b/templates/system/syslog/file/node.tag/archive/node.def index 873cd0a6..0e7f6b3e 100644 --- a/templates/system/syslog/file/node.tag/archive/node.def +++ b/templates/system/syslog/file/node.tag/archive/node.def @@ -1,5 +1,4 @@ help: Log file size and rotation characteristics delete: - sudo sh -c "/opt/vyatta/sbin/vyatta_update_logrotate.pl \ - '$VAR(../@)' '$VAR(files/@)' '$VAR(size/@)' 0" + sudo rm -f "/opt/vyatta/etc/logrotate/file_$VAR(../@)" diff --git a/templates/system/syslog/file/node.tag/archive/size/node.def b/templates/system/syslog/file/node.tag/archive/size/node.def index f3e7e52f..0c9a1f7e 100644 --- a/templates/system/syslog/file/node.tag/archive/size/node.def +++ b/templates/system/syslog/file/node.tag/archive/size/node.def @@ -3,7 +3,3 @@ type: u32 help: Size of log files (kbytes) default: 0 - -update: - sudo sh -c "/opt/vyatta/sbin/vyatta_update_logrotate.pl \ - '$VAR(../../@)' '$VAR(../files/@)' '$VAR(@)' 1" diff --git a/templates/system/syslog/global/archive/files/node.def b/templates/system/syslog/global/archive/files/node.def index d4e8af82..bb60506c 100644 --- a/templates/system/syslog/global/archive/files/node.def +++ b/templates/system/syslog/global/archive/files/node.def @@ -3,7 +3,3 @@ type: u32 help: Number of saved files default: 5 - -update: - sudo sh -c "/opt/vyatta/sbin/vyatta_update_logrotate.pl \ - '$VAR(@)' '$VAR(../size/@)' 1" diff --git a/templates/system/syslog/global/archive/node.def b/templates/system/syslog/global/archive/node.def index 82bc9e86..2ec10727 100644 --- a/templates/system/syslog/global/archive/node.def +++ b/templates/system/syslog/global/archive/node.def @@ -1,5 +1 @@ help: Log file size and rotation characteristics - -delete: - sudo sh -c "/opt/vyatta/sbin/vyatta_update_logrotate.pl \ - '$VAR(files/@)' '$VAR(size/@)' 0" diff --git a/templates/system/syslog/global/archive/size/node.def b/templates/system/syslog/global/archive/size/node.def index 341f4a5b..4d360a44 100644 --- a/templates/system/syslog/global/archive/size/node.def +++ b/templates/system/syslog/global/archive/size/node.def @@ -3,7 +3,3 @@ type: u32 help: Size of log files (kbytes) default: 250 - -update: - sudo sh -c "/opt/vyatta/sbin/vyatta_update_logrotate.pl \ - '$VAR(../files/@)' '$VAR(@)' 1" diff --git a/templates/system/syslog/node.def b/templates/system/syslog/node.def index 81fb3f6c..ebe02232 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 rsyslog restart + sudo /usr/sbin/invoke-rc.d rsyslog reload || sudo /usr/sbin/invoke-rc.d rsyslog restart fi -- cgit v1.2.3