Commit 4d6a635f authored by Jennifer Davis's avatar Jennifer Davis Committed by GitHub
Browse files

Merge pull request #112 from chef-cookbooks/cleanup_merge

This is a cleanup and merge/replaces PR #76, #105, #110 
parents d0ddce5f b233acaf
settings:
parallel: true
driver:
name: docker
# privileged is required otherwise the container doesn't boot right
privileged: true
name: dokken
chef_version: latest
privileged: true # because Docker and SystemD/Upstart
transport:
name: dokken
provisioner:
name: dokken
verifier:
name: inspec
format: doc
platforms:
- name: centos-6
- name: debian-7
driver:
image: centos:6
image: debian:7
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https net-tools -y
- name: debian-8
driver:
image: debian:8
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https net-tools -y
- name: centos-5
driver:
image: centos:5
platform: rhel
run_command: /sbin/init
provision_command:
- /usr/bin/yum install -y initscripts net-tools wget
- name: centos-6
driver:
image: centos:6
intermediate_instructions:
- RUN yum -y install tar which initscripts
- name: centos-7
driver:
image: centos:7
platform: rhel
run_command: /usr/lib/systemd/systemd
provision_command:
- /bin/yum install -y initscripts net-tools wget
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN yum clean all
- RUN yum -y install net-tools lsof
- name: fedora-23
driver:
image: fedora:23
pid_one_command: /usr/lib/systemd/systemd
intermediate_instructions:
- RUN dnf -y install tar yum
- name: ubuntu-12.04
driver:
image: ubuntu-upstart:12.04
platform: ubuntu
disable_upstart: false
run_command: /sbin/init
provision_command:
- /usr/bin/apt-get update
- /usr/bin/apt-get install apt-transport-https net-tools -y
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https net-tools -y
- name: ubuntu-14.04
driver:
image: ubuntu-upstart:14.04
platform: ubuntu
disable_upstart: false
run_command: /sbin/init
provision_command:
- /usr/bin/apt-get update
- /usr/bin/apt-get install apt-transport-https net-tools -y
pid_one_command: /sbin/init
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https net-tools -y
- name: ubuntu-16.04
driver:
image: ubuntu:16.04
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN /usr/bin/apt-get update
- RUN /usr/bin/apt-get install apt-transport-https net-tools -y
suites:
- name: default
run_list:
- recipe[rsyslog::default]
- name: relp
run_list:
- recipe[rsyslog::client]
attributes:
rsyslog:
use_relp: true
custom_remote:
- server: 10.0.0.45
logs: auth.*,mail.*
port: 555
protocol: udp
- server: 10.1.1.33
logs: authpriv.*,cron.*,daemon.*
port: 654
protocol: tcp
remote_template: RSYSLOG_SyslogProtocol23Format
- name: client
run_list:
- recipe[rsyslog_test::client]
attributes:
rsyslog:
server_ip: 10.0.0.50
custom_remote:
- server: 10.0.0.45
logs: auth.*,mail.*
port: 555
protocol: udp
- server: 10.1.1.33
logs: authpriv.*,cron.*,daemon.*
port: 654
protocol: tcp
remote_template: RSYSLOG_SyslogProtocol23Format
- name: server
run_list:
- recipe[rsyslog_test::server]
- name: input_file_provider
run_list:
- recipe[rsyslog_test::input_file_provider]
- name: opensuse-13.2
driver:
image: opensuse:13.2
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive
- name: opensuse-42.1
driver:
image: opensuse:42.1
pid_one_command: /bin/systemd
intermediate_instructions:
- RUN zypper --non-interactive install aaa_base perl-Getopt-Long-Descriptive
......@@ -16,6 +16,7 @@ platforms:
run_list: yum::dnf_yum_compat
- name: fedora-23
run_list: yum::dnf_yum_compat
- name: opensuse-13.2
- name: ubuntu-12.04
run_list: apt::default
- name: ubuntu-14.04
......
rvm: 2.2
sudo: required
dist: trusty
......@@ -11,6 +9,10 @@ addons:
packages:
- chefdk
branches:
only:
- master
services: docker
env:
......@@ -40,12 +42,13 @@ before_script:
# https://github.com/zuazo/kitchen-in-travis-native/issues/1#issuecomment-142230889
- sudo iptables -L DOCKER || ( echo "DOCKER iptables chain missing" ; sudo iptables -N DOCKER )
- eval "$(/opt/chefdk/bin/chef shell-init bash)"
- /opt/chefdk/embedded/bin/chef gem install kitchen-docker
- /opt/chefdk/embedded/bin/chef gem install kitchen-dokken
script:
- /opt/chefdk/embedded/bin/chef --version
- /opt/chefdk/embedded/bin/rubocop --version
- /opt/chefdk/embedded/bin/rubocop
- /opt/chefdk/embedded/bin/cookstyle --version
- /opt/chefdk/embedded/bin/cookstyle
- /opt/chefdk/embedded/bin/foodcritic --version
- /opt/chefdk/embedded/bin/foodcritic . --exclude spec -f any
- /opt/chefdk/embedded/bin/rspec
#- /opt/chefdk/embedded/bin/rspec
- KITCHEN_LOCAL_YAML=.kitchen.docker.yml /opt/chefdk/embedded/bin/kitchen verify ${INSTANCE}
# rsyslog Cookbook CHANGELOG
This file is used to list changes made in each version of the rsyslog cookbook.
## v.4.0.1 (UNRELEASED)
- PR #76 Validate the config file using `rsyslogd -N 1` via eherot
- PR #105 Use correct file name for remote.conf via mfenner
- PR #105 Add $LocalHostName directive via mfenner
- PR #105 Change directive `:fromhost-ip,!isequal,"127.0.0.1"` from using ~ to stop via mfenner
- PR #110 Add support for permitted peer via dastergon
- Add SUSE support
- Clean up travis configuration
## v.4.0.0 (2015-12-09)
- Removed support for Chef Solo. Since this cookbook now supports Chef 12+ only it makes far more sense to use Chef Zero (local mode) if a Chef server is not available.
- Removed yum from the Berksfile as it wasn't being used
......
......@@ -9,6 +9,7 @@ Installs and configures rsyslog to replace sysklogd for client and/or server use
- RHEL/CentOS/Scientific/Amazon/Oracle
- Fedora 21+
- OmniOS r151006c
- OpenSUSE
### Chef
- Chef 12+
......@@ -55,10 +56,12 @@ See `attributes/default.rb` for default values.
- `node['rsyslog']['tls_certificate_file']` - Path to TLS certificate file. Required for server, optional for clients.
- `node['rsyslog']['tls_key_file']` - Path to TLS key file. Required for server, optional for clients.
- `node['rsyslog']['tls_auth_mode']` - Value for `$InputTCPServerStreamDriverAuthMode`/`$ActionSendStreamDriverAuthMode`, determines whether client certs are validated. Defaults to `anon` (no validation).
- `node['rsyslog']['tls_permitted_peer']` - Value for `ActionSendStreamDriverPermittedPeer`, it narrows the list of the allowed hosts. Works with TLS only. Defaults to `nil`.
- `node['rsyslog']['use_local_ipv4']` - Whether or not to make use the remote local IPv4 address on cloud systems when searching for servers (where available). Default is 'false'.
- `node['rsyslog']['allow_non_local']` - Whether or not to allow non-local messages. If 'false', incoming messages are only allowed from 127.0.0.1. Default is 'false'.
- `node['rsyslog']['custom_remote']` - Array of hashes for configuring custom remote server targets
- `node['rsyslog']['additional_directives']` - Hash of additional directives and their values to place in the main rsyslog config file
- `node['rsyslog']['local_host_name']` - permits to overwrite the system hostname with the one specified in the directive
## Recipes
### default
......@@ -97,7 +100,7 @@ Any previous logs are not cleaned up from the `log_dir`.
### server
Configures the node to be a rsyslog server. The chosen rsyslog server node should be defined in the `server_ip` attribute or resolvable by the specified search criteria specified in `node['rsyslog']['server_search]` (so that nodes making use of the `client` recipe can find the server to log to).
This recipe will create the logs in `node['rsyslog']['log_dir']`, and the configuration is in `/etc/rsyslog.d/server.conf`. This recipe also removes any previous configuration to a remote server by removing the `/etc/rsyslog.d/remote.conf` file.
The `server` recipe will create the logs in attribute `node['rsyslog']['log_dir']`, and the configuration in `/etc/rsyslog.d/server.conf`. This recipe also removes any previous configuration to a remote server by removing the file `/etc/rsyslog.d/49-remote.conf`.
The cron job used in the previous version of this cookbook is removed, but it does not remove any existing cron job from your system (so it doesn't break anything unexpectedly). We recommend setting up logrotate for the logfiles instead.
......
......@@ -17,6 +17,7 @@
# limitations under the License.
#
default['rsyslog']['local_host_name'] = nil
default['rsyslog']['default_log_dir'] = '/var/log'
default['rsyslog']['log_dir'] = '/srv/rsyslog'
default['rsyslog']['working_dir'] = '/var/spool/rsyslog'
......@@ -47,6 +48,7 @@ default['rsyslog']['tls_ca_file'] = nil
default['rsyslog']['tls_certificate_file'] = nil
default['rsyslog']['tls_key_file'] = nil
default['rsyslog']['tls_auth_mode'] = 'anon'
default['rsyslog']['tls_permitted_peer'] = nil
default['rsyslog']['use_local_ipv4'] = false
default['rsyslog']['allow_non_local'] = false
default['rsyslog']['custom_remote'] = [{}]
......@@ -61,8 +63,50 @@ default['rsyslog']['priv_user'] = nil
default['rsyslog']['priv_group'] = nil
default['rsyslog']['modules'] = %w(imuxsock imklog)
# platform specific attributes
case node['platform']
when 'ubuntu'
# syslog user introduced with natty package
if node['platform_version'].to_f >= 11.04
default['rsyslog']['user'] = 'syslog'
default['rsyslog']['group'] = 'adm'
default['rsyslog']['priv_seperation'] = true
default['rsyslog']['priv_group'] = 'syslog'
end
when 'arch'
default['rsyslog']['service_name'] = 'rsyslogd'
when 'smartos'
default['rsyslog']['config_prefix'] = '/opt/local/etc'
default['rsyslog']['modules'] = %w(immark imsolaris imtcp imudp)
default['rsyslog']['group'] = 'root'
when 'omnios'
default['rsyslog']['service_name'] = 'system/rsyslogd'
default['rsyslog']['modules'] = %w(immark imsolaris imtcp imudp)
default['rsyslog']['group'] = 'root'
end
# platform family specific attributes
case node['platform_family']
when 'suse'
default['rsyslog']['service_name'] = 'syslog'
default['rsyslog']['group'] = 'root'
default['rsyslog']['default_facility_logs'] = {
'*.emerg' => ':omusrmsg:*',
'mail.*' => "-#{node['rsyslog']['default_log_dir']}/mail.log",
'mail.info' => "-#{node['rsyslog']['default_log_dir']}/mail.info",
'mail.warning' => "-#{node['rsyslog']['default_log_dir']}/mail.warn",
'mail.err' => "#{node['rsyslog']['default_log_dir']}/mail.err",
'news.crit' => "#{node['rsyslog']['default_log_dir']}/news/news.crit",
'news.err' => "#{node['rsyslog']['default_log_dir']}/news/news.err",
'news.notice' => "-#{node['rsyslog']['default_log_dir']}/news/news.notice",
'*.=warning;*.=err' => "-#{node['rsyslog']['default_log_dir']}/warn",
'*.crit' => "#{node['rsyslog']['default_log_dir']}/warn",
'*.*;mail.none;news.none' => "#{node['rsyslog']['default_log_dir']}/messages",
'local0.*;local1.*' => "-#{node['rsyslog']['default_log_dir']}/localmessages",
'local2.*;local3.*' => "-#{node['rsyslog']['default_log_dir']}/localmessages",
'local4.*;local5.*' => "-#{node['rsyslog']['default_log_dir']}/localmessages",
'local6.*;local7.*' => "-#{node['rsyslog']['default_log_dir']}/localmessages"
}
when 'rhel', 'fedora'
default['rsyslog']['working_dir'] = '/var/lib/rsyslog'
# format { facility => destination }
......@@ -105,27 +149,3 @@ end
if (node['platform'] == 'ubuntu' && node['platform_version'].to_i < 12) || (node['platform_family'] == 'rhel' && node['platform_version'].to_i < 6)
default['rsyslog']['default_facility_logs']['*.emerg'] = '*'
end
# platform specific attributes
case node['platform']
when 'ubuntu'
# syslog user introduced with natty package
if node['platform_version'].to_f >= 11.04
default['rsyslog']['user'] = 'syslog'
default['rsyslog']['group'] = 'adm'
default['rsyslog']['priv_seperation'] = true
default['rsyslog']['priv_group'] = 'syslog'
end
when 'arch'
default['rsyslog']['service_name'] = 'rsyslogd'
when 'smartos'
default['rsyslog']['config_prefix'] = '/opt/local/etc'
default['rsyslog']['modules'] = %w(immark imsolaris imtcp imudp)
default['rsyslog']['group'] = 'root'
when 'omnios'
default['rsyslog']['service_name'] = 'system/rsyslogd'
default['rsyslog']['modules'] = %w(immark imsolaris imtcp imudp)
default['rsyslog']['group'] = 'root'
when 'suse'
default['rsyslog']['service_name'] = 'syslog'
end
......@@ -51,19 +51,20 @@ if rsyslog_servers.empty?
Chef::Log.warn('The rsyslog::client recipe was unable to determine the remote syslog server. Checked both the server_ip attribute and search! Not forwarding logs.')
else
remote_type = node['rsyslog']['use_relp'] ? 'relp' : 'remote'
template "#{node['rsyslog']['config_prefix']}/rsyslog.d/49-remote.conf" do
source "49-#{remote_type}.conf.erb"
owner 'root'
group 'root'
mode '0644'
variables(servers: rsyslog_servers)
notifies :run, 'execute[validate_config]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
only_if { node['rsyslog']['remote_logs'] }
end
end
file "#{node['rsyslog']['config_prefix']}/rsyslog.d/server.conf" do
action :delete
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
file "#{node['rsyslog']['config_prefix']}/rsyslog.d/server.conf" do
action :delete
notifies :run, 'execute[validate_config]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
end
......@@ -21,7 +21,7 @@ package 'rsyslog'
package 'rsyslog-relp' if node['rsyslog']['use_relp']
if node['rsyslog']['enable_tls'] && node['rsyslog']['tls_ca_file']
Chef::Application.fatal!("Recipe rsyslog::default can not use 'enable_tls' with protocol '#{node['rsyslog']['protocol']}' (requires 'tcp')") unless node['rsyslog']['protocol'] == 'tcp'
Chef::Log.fatal("Recipe rsyslog::default can not use 'enable_tls' with protocol '#{node['rsyslog']['protocol']}' (requires 'tcp')") unless node['rsyslog']['protocol'] == 'tcp'
package 'rsyslog-gnutls'
end
......@@ -31,12 +31,19 @@ directory "#{node['rsyslog']['config_prefix']}/rsyslog.d" do
mode '0755'
end
log node['rsyslog']['group']
directory node['rsyslog']['working_dir'] do
owner node['rsyslog']['user']
group node['rsyslog']['group']
mode '0700'
end
execute 'validate_config' do
command "rsyslogd -N 1 -f #{node['rsyslog']['config_prefix']}/rsyslog.conf"
action :nothing
end
# Our main stub which then does its own rsyslog-specific
# include of things in /etc/rsyslog.d/*
template "#{node['rsyslog']['config_prefix']}/rsyslog.conf" do
......@@ -44,6 +51,7 @@ template "#{node['rsyslog']['config_prefix']}/rsyslog.conf" do
owner 'root'
group 'root'
mode '0644'
notifies :run, 'execute[validate_config]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
......@@ -52,6 +60,7 @@ template "#{node['rsyslog']['config_prefix']}/rsyslog.d/50-default.conf" do
owner 'root'
group 'root'
mode '0644'
notifies :run, 'execute[validate_config]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
......
......@@ -18,7 +18,7 @@
#
# Manually set this attribute
node.set['rsyslog']['server'] = true
node.normal['rsyslog']['server'] = true
include_recipe 'rsyslog::default'
......@@ -34,12 +34,14 @@ template "#{node['rsyslog']['config_prefix']}/rsyslog.d/35-server-per-host.conf"
owner 'root'
group 'root'
mode '0644'
notifies :run, 'execute[validate_config]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
end
# if we're a server we shouldn't be sending logs to a remote like a client
file "#{node['rsyslog']['config_prefix']}/rsyslog.d/remote.conf" do
file "#{node['rsyslog']['config_prefix']}/rsyslog.d/49-remote.conf" do
action :delete
notifies :run, 'execute[validate_config]'
notifies :restart, "service[#{node['rsyslog']['service_name']}]"
only_if { ::File.exist?("#{node['rsyslog']['config_prefix']}/rsyslog.d/remote.conf") }
only_if { ::File.exist?("#{node['rsyslog']['config_prefix']}/rsyslog.d/49-remote.conf") }
end
......@@ -3,8 +3,8 @@ require 'spec_helper'
describe 'rsyslog::client' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['rsyslog']['server_ip'] = server_ip
node.set['rsyslog']['custom_remote'] = custom_remote
node.normal['rsyslog']['server_ip'] = server_ip
node.normal['rsyslog']['custom_remote'] = custom_remote
end.converge(described_recipe)
end
......@@ -42,8 +42,8 @@ describe 'rsyslog::client' do
context 'on SmartOS' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: 'joyent_20130111T180733Z') do |node|
node.set['rsyslog']['server_ip'] = server_ip
node.set['rsyslog']['custom_remote'] = custom_remote
node.normal['rsyslog']['server_ip'] = server_ip
node.normal['rsyslog']['custom_remote'] = custom_remote
end.converge(described_recipe)
end
......@@ -85,7 +85,7 @@ describe 'rsyslog::client' do
context 'on SmartOS' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: 'joyent_20130111T180733Z') do |node|
node.set['rsyslog']['server_ip'] = server_ip
node.normal['rsyslog']['server_ip'] = server_ip
end.converge(described_recipe)
end
......
......@@ -14,7 +14,7 @@ describe 'rsyslog::default' do
context "when node['rsyslog']['relp'] is true" do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['rsyslog']['use_relp'] = true
node.normal['rsyslog']['use_relp'] = true
end.converge(described_recipe)
end
......@@ -27,7 +27,7 @@ describe 'rsyslog::default' do
context "when node['rsyslog']['tls_ca_file'] is not set" do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['rsyslog']['enable_tls'] = true
node.normal['rsyslog']['enable_tls'] = true
end.converge(described_recipe)
end
......@@ -39,8 +39,8 @@ describe 'rsyslog::default' do
context "when node['rsyslog']['tls_ca_file'] is set" do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['rsyslog']['enable_tls'] = true
node.set['rsyslog']['tls_ca_file'] = '/etc/path/to/ssl-ca.crt'
node.normal['rsyslog']['enable_tls'] = true
node.normal['rsyslog']['tls_ca_file'] = '/etc/path/to/ssl-ca.crt'
end.converge(described_recipe)
end
......@@ -56,9 +56,9 @@ describe 'rsyslog::default' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['rsyslog']['enable_tls'] = true
node.set['rsyslog']['tls_ca_file'] = '/etc/path/to/ssl-ca.crt'
node.set['rsyslog']['protocol'] = 'udp'
node.normal['rsyslog']['enable_tls'] = true
node.normal['rsyslog']['tls_ca_file'] = '/etc/path/to/ssl-ca.crt'
node.normal['rsyslog']['protocol'] = 'udp'
end.converge(described_recipe)
end
......
......@@ -3,7 +3,7 @@ require 'spec_helper'
describe 'rsyslog::server' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'ubuntu', version: '12.04') do |node|
node.set['rsyslog']['server'] = false
node.normal['rsyslog']['server'] = false
end.converge(described_recipe)
end
......@@ -57,7 +57,7 @@ describe 'rsyslog::server' do
context 'on SmartOS' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: 'joyent_20130111T180733Z') do |node|
node.set['rsyslog']['server'] = false
node.normal['rsyslog']['server'] = false
end.converge(described_recipe)
end
......@@ -82,15 +82,15 @@ describe 'rsyslog::server' do
end
end
context '/etc/rsyslog.d/remote.conf file' do
context '/etc/rsyslog.d/49-remote.conf file' do
before do
allow(File).to receive(:exist?).and_return(true)
end
let(:file) { chef_run.file('/etc/rsyslog.d/remote.conf') }
let(:file) { chef_run.file('/etc/rsyslog.d/49-remote.conf') }
it 'deletes the file' do
expect(chef_run).to delete_file('/etc/rsyslog.d/remote.conf')
expect(chef_run).to delete_file('/etc/rsyslog.d/49-remote.conf')
end
it 'notifies restarting the service' do
......@@ -104,14 +104,14 @@ describe 'rsyslog::server' do
let(:chef_run) do
ChefSpec::ServerRunner.new(platform: 'smartos', version: 'joyent_20130111T180733Z') do |node|
node.set['rsyslog']['server'] = false
node.normal['rsyslog']['server'] = false
end.converge(described_recipe)
end
let(:file) { chef_run.file('/opt/local/etc/rsyslog.d/remote.conf') }
let(:file) { chef_run.file('/opt/local/etc/rsyslog.d/49-remote.conf') }
it 'deletes the file' do
expect(chef_run).to delete_file('/opt/local/etc/rsyslog.d/remote.conf')
expect(chef_run).to delete_file('/opt/local/etc/rsyslog.d/49-remote.conf')
end
it 'notifies restarting the service' do
......
require 'chef/application'
# require 'chef/application'
require 'chefspec'
require 'chefspec/berkshelf'
......
......@@ -58,5 +58,5 @@ news.notice -?PerHostNewsNotice
# Stop processing of all non-local messages. You can process remote messages
# on levels less than 35.
#
:fromhost-ip,!isequal,"127.0.0.1" ~
:fromhost-ip,!isequal,"127.0.0.1" stop
<% end -%>
......@@ -16,6 +16,9 @@ $DefaultNetstreamDriverKeyFile <%= node['rsyslog']['tls_key_file'] %>
$DefaultNetstreamDriver gtls
$ActionSendStreamDriverMode 1
$ActionSendStreamDriverAuthMode <%= node['rsyslog']['tls_auth_mode'] %>
<% if node['rsyslog']['tls_permitted_peer'] -%>
$ActionSendStreamDriverPermittedPeer <%= node['rsyslog']['tls_permitted_peer'] %>
<% end -%>
<% end -%>
<% @servers.each do |server| -%>
......
......@@ -7,6 +7,12 @@
#
# Default logging rules can be found in /etc/rsyslog.d/50-default.conf
#
# Set hostname
#
<% if node['rsyslog']['local_host_name'] -%>
$LocalHostName <%= node['rsyslog']['local_host_name'] %>
<% end %>
#
# Set max message size
#
$MaxMessageSize <%= node['rsyslog']['max_message_size'] %>
......
require 'fileutils'
unless Dir.exist?("#{node['rsyslog']['config_prefix']}/rsyslog.d")
FileUtils.mkdir("#{node['rsyslog']['config_prefix']}/rsyslog.d")
end
FileUtils.touch("#{node['rsyslog']['config_prefix']}/rsyslog.d/remote.conf")
include_recipe 'rsyslog::server'
......@@ -8,6 +8,6 @@ describe file('/etc/rsyslog.d/35-server-per-host.conf') do
it { should be_file }
end
describe file('/etc/rsyslog.d/remote.conf') do
describe file('/etc/rsyslog.d/49-remote.conf') do
it { should_not be_file }
end