diff --git a/README.md b/README.md index e3e1935..16b1ec9 100644 --- a/README.md +++ b/README.md @@ -335,7 +335,7 @@ Transport protocol used by rsyslog. Valid values are 'tcp' and 'udp' log_server ---------- -String or array of server to send logs to if remote_logging is true. +String or array of server to send logs to if remote_logging is true. May include an optional port number if you wish to override the log_server_port value for an entry. *Example:*
@@ -346,6 +346,7 @@ _OR_ rsyslog::log_server: - 'log1' - 'log2:1514' + - 'log3:2514'- *Default*: "log.${::domain}" diff --git a/spec/classes/init_spec.rb b/spec/classes/init_spec.rb index 9f111e1..baf7970 100644 --- a/spec/classes/init_spec.rb +++ b/spec/classes/init_spec.rb @@ -250,7 +250,7 @@ it { should contain_file('rsyslog_config').without_content(/^\$ModLoad imtcp.so$/) } end - ['logserver', %w(logserver1 logserver2)].each do |values| + ['logserver', %w(logserver1 logserver2 logserver3:1514 logserver4:2514)].each do |values| context "with remote_logging enabled and log_server=#{values} (as #{values.class})" do let :params do { @@ -261,7 +261,11 @@ if values.class == Array values.each do |value| - it { should contain_file('rsyslog_config').with_content(/^\*\.\* @@#{value}:514$/) } + if value.include? ":" + it { should contain_file('rsyslog_config').with_content(/^\*\.\* @@#{value}$/) } + else + it { should contain_file('rsyslog_config').with_content(/^\*\.\* @@#{value}:514$/) } + end end else it { should contain_file('rsyslog_config').with_content(/^\*\.\* @@logserver:514$/) }