Skip to content
Snippets Groups Projects
Commit 3b4c1831 authored by Russ Allbery's avatar Russ Allbery
Browse files

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.
parent da154868
No related branches found
No related tags found
No related merge requests found
#!/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
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment