Commit 704ed554 authored by Paul Mooring's avatar Paul Mooring Committed by Seth Vargo
Browse files

[COOK-3435] Add support for RELP


Signed-off-by: default avatarSeth Vargo <sethvargo@gmail.com>
parent 35e052d7
......@@ -16,6 +16,14 @@ suites:
- name: default
run_list:
- recipe[rsyslog::default]
- name: relp
run_list:
- recipe[rsyslog::default]
attributes:
rsyslog:
use_relp: true
excludes:
- centos-5.9 # Centos5 does not support relp
- name: client
run_list:
- recipe[rsyslog::client]
......
......@@ -19,6 +19,8 @@
default['rsyslog']['log_dir'] = '/srv/rsyslog'
default['rsyslog']['server'] = false
default['rsyslog']['use_relp'] = false
default['rsyslog']['relp_port'] = 20514
default['rsyslog']['protocol'] = 'tcp'
default['rsyslog']['port'] = 514
default['rsyslog']['server_ip'] = nil
......
......@@ -39,8 +39,10 @@ if rsyslog_servers.empty?
Chef::Application.fatal!('The rsyslog::client recipe was unable to determine the remote syslog server. Checked both the server_ip attribute and search!')
end
remote_type = node['rsyslog']['use_relp'] ? 'relp' : 'remote'
template '/etc/rsyslog.d/49-remote.conf' do
source '49-remote.conf.erb'
source "49-#{remote_type}.conf.erb"
owner 'root'
group 'root'
mode '0644'
......
......@@ -19,6 +19,10 @@
package 'rsyslog'
if node['rsyslog']['use_relp']
package 'rsyslog-relp'
end
directory '/etc/rsyslog.d' do
owner 'root'
group 'root'
......
......@@ -9,6 +9,18 @@ describe 'rsyslog::default' do
expect(chef_run).to install_package('rsyslog')
end
context "when node['rsyslog']['relp'] is true" do
let(:chef_run) do
ChefSpec::ChefRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['rsyslog']['use_relp'] = true
end.converge('rsyslog::default')
end
it 'installs the rsyslog-relp package' do
expect(chef_run).to install_package('rsyslog-relp')
end
end
context '/etc/rsyslog.d directory' do
let(:directory) { chef_run.directory('/etc/rsyslog.d') }
......
# Generated by Chef
# Local modifications will be overwritten
<% if node['rsyslog']['use_relp'] -%>
$ModLoad imrelp
$InputRELPServerRun <%= node['rsyslog']['relp_port'] %>
<% end -%>
$DirGroup <%= node['rsyslog']['group'] %>
$DirCreateMode 0755
$FileGroup <%= node['rsyslog']['group'] %>
......
$ModLoad omrelp
$ActionQueueType LinkedList # use asynchronous processing
$ActionQueueFileName srvrfwd # set file name, also enables disk mode
$ActionResumeRetryCount -1 # infinite retries on insert failure
$ActionQueueSaveOnShutdown on # save in-memory data if rsyslog shuts down
*.* :omrelp:<%= "#{@server}:#{node['rsyslog']['relp_port']}" %>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment