Skip to content
Snippets Groups Projects
test-config 1.82 KiB
Newer Older
Adam Lewenberg's avatar
Adam Lewenberg committed
#!/usr/bin/ruby
#
# Test the config ERB template with the variables below.

require 'erb'

template = File.readlines('config.erb').join
Adam Lewenberg's avatar
Adam Lewenberg committed

#     # 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',
Adam Lewenberg's avatar
Adam Lewenberg committed
#     }
stop = ''
name = 'messages'
frequency = 'daily'
directory = '/var/log'
archive = ''
restart = 'hup /var/run/syslogd.pid'
log_owner = 'root'
log_group = 'root'
log_mode = '640'
logs = [ 'messages' ]
analyze = '/usr/bin/filter-syslog'
Adam Lewenberg's avatar
Adam Lewenberg committed
save_num = '30'

message = ERB.new(template, 0, '-')
Adam Lewenberg's avatar
Adam Lewenberg committed
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' ],
#       analyze      => '/usr/bin/filter-syslog /etc/webkdc/filter.conf',
#       analyze_logs => [ 'error.log' ],
Adam Lewenberg's avatar
Adam Lewenberg committed
#     }
save_num = '15'
name = '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' ]
message = ERB.new(template, 0, '-')
Adam Lewenberg's avatar
Adam Lewenberg committed
puts message.result