From 3b4c1831244d406c0c2c3d80952397a1e461201c Mon Sep 17 00:00:00 2001 From: Russ Allbery <rra@stanford.edu> Date: Tue, 2 Jul 2013 14:45:02 -0700 Subject: [PATCH] Fix template test script for newsyslog::config Make the script executable, test analyze_logs, and fix for to_s on an array no longer resulting in a good template string. --- templates/newsyslog/test-config | 50 +++++++++++++++++---------------- 1 file changed, 26 insertions(+), 24 deletions(-) mode change 100644 => 100755 templates/newsyslog/test-config diff --git a/templates/newsyslog/test-config b/templates/newsyslog/test-config old mode 100644 new mode 100755 index 0d1f314..7f2c895 --- a/templates/newsyslog/test-config +++ b/templates/newsyslog/test-config @@ -1,23 +1,22 @@ #!/usr/bin/ruby -# $Id: test-config 12280 2008-12-16 03:00:00Z rra $ # # Test the config ERB template with the variables below. require 'erb' -template = File.readlines("config.erb").to_s +template = File.readlines('config.erb').join # # Rotate /var/log/messages on local disk and analyze it. -# newsyslog::config { "messages": -# frequency => "daily", -# directory => "/var/log", -# restart => "hup /var/run/syslogd.pid" -# log_owner => "root", -# log_group => "root", -# log_mode => 640, -# logs => [ "messages" ], -# analyze => "/usr/bin/filter-syslog", -# save_num => "30", +# newsyslog::config { 'messages': +# frequency => 'daily', +# directory => '/var/log', +# restart => 'hup /var/run/syslogd.pid' +# log_owner => 'root', +# log_group => 'root', +# log_mode => 640, +# logs => [ 'messages' ], +# analyze => '/usr/bin/filter-syslog', +# save_num => '30', # } stop = '' name = 'messages' @@ -32,21 +31,23 @@ logs = [ 'messages' ] analyze = '/usr/bin/filter-syslog' save_num = '30' -message = ERB.new(template, 0, "-") +message = ERB.new(template, 0, '-') puts message.result puts '=' * 76 # # Rotate Apache logs and save a copy into AFS. -# newsyslog::config { "apache": -# frequency => "daily", -# directory => "/var/log/apache2", -# archive => "/afs/ir/service/auth/logs/weblogin" -# restart => "run /usr/sbin/apache2ctl graceful", -# log_owner => "root", -# log_group => "root", -# log_mode => 644, -# logs => [ "access.log", "error.log" ] +# newsyslog::config { 'apache': +# frequency => 'daily', +# directory => '/var/log/apache2', +# archive => '/afs/ir/service/auth/logs/weblogin' +# restart => 'run /usr/sbin/apache2ctl graceful', +# log_owner => 'root', +# log_group => 'root', +# log_mode => 644, +# logs => [ 'access.log', 'error.log' ], +# analyze => '/usr/bin/filter-syslog /etc/webkdc/filter.conf', +# analyze_logs => [ 'error.log' ], # } save_num = '15' name = 'apache' @@ -58,7 +59,8 @@ log_owner = 'root' log_group = 'root' log_mode = '644' logs = [ 'access.log', 'error.log' ] -analyze = '' +analyze = '/usr/bin/filter-syslog /etc/webkdc/filter.conf' +analyze_logs = [ 'error.log' ] -message = ERB.new(template, 0, "-") +message = ERB.new(template, 0, '-') puts message.result -- GitLab