Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

rsyslog default configuration generated incorrectly on Amazon Linux 2 #146

Closed
blueben opened this issue Jul 4, 2018 · 3 comments
Closed
Labels
Stale This is marked as stale and will be closed shortly

Comments

@blueben
Copy link

blueben commented Jul 4, 2018

Cookbook version

6.0.4

Chef-client version

12.22.5

Platform Details

Amazon Linux release 2 (2017.12) LTS Release Candidate

Scenario:

Using the rsyslog cookbook in default trim on Amazon linux fails to provide a valid configuration.

Steps to Reproduce:

Include the rsyslog cookbook via recipe in a wrapper cookbook. eg. include_recipe 'rsyslog'

Expected Result:

rsyslog installs cleanly with a working configuration

Actual Result:

amazon-ebs: [2018-07-03T23:44:15+00:00] INFO: template[/etc/rsyslog.conf] sending run action to execute[validate_config] (delayed)
amazon-ebs: [2018-07-03T23:44:15+00:00] INFO: Processing execute[validate_config] action run (rsyslog::default line 40)
amazon-ebs:
amazon-ebs: ================================================================================
amazon-ebs: Error executing action `run` on resource 'execute[validate_config]'
amazon-ebs: ================================================================================
amazon-ebs:
amazon-ebs: Mixlib::ShellOut::ShellCommandFailed
amazon-ebs: ------------------------------------
amazon-ebs: Expected process to exit with [0], but received '1'
amazon-ebs: ---- Begin output of rsyslogd -N 1 -f /etc/rsyslog.conf ----
amazon-ebs: STDOUT:
amazon-ebs: STDERR: rsyslogd: version 8.24.0, config validation run (level 1), master config /etc/rsyslog.conf
amazon-ebs: rsyslogd: error during parsing file /etc/rsyslog.d/50-default.conf, on or before line 8: warnings occured in file '/etc/rsyslog.d/50-default.conf' around line 8 [v8.24.0 try http://www.rsyslog.com/e/2207 ]                                           [0/1989]
amazon-ebs: ---- End output of rsyslogd -N 1 -f /etc/rsyslog.conf ----
amazon-ebs: Ran rsyslogd -N 1 -f /etc/rsyslog.conf returned 1
amazon-ebs:
amazon-ebs: Resource Declaration:
amazon-ebs: ---------------------
amazon-ebs: # In /tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/rsyslog/recipes/default.rb
amazon-ebs:
amazon-ebs:  40: execute 'validate_config' do
amazon-ebs:  41:   command "rsyslogd -N 1 -f #{node['rsyslog']['config_prefix']}/rsyslog.conf"
amazon-ebs:  42:   action  :nothing
amazon-ebs:  43: end
amazon-ebs:  44:
amazon-ebs:
amazon-ebs: Compiled Resource:
amazon-ebs: ------------------
amazon-ebs: # Declared in /tmp/packer-chef-solo/local-mode-cache/cache/cookbooks/rsyslog/recipes/default.rb:40:in `from_file'
amazon-ebs:
amazon-ebs: execute("validate_config") do
amazon-ebs:   action [:nothing]
amazon-ebs:   retries 0
amazon-ebs:   retry_delay 2
amazon-ebs:   default_guard_interpreter :execute
amazon-ebs:   command "rsyslogd -N 1 -f /etc/rsyslog.conf"
amazon-ebs:   backup 5
amazon-ebs:   returns 0
amazon-ebs:   user nil
amazon-ebs:   declared_type :execute
amazon-ebs:   cookbook_name "rsyslog"
amazon-ebs:   recipe_name "default"
amazon-ebs: end
amazon-ebs:
amazon-ebs: System Info:
amazon-ebs: ------------
amazon-ebs: chef_version=12.22.5
amazon-ebs: platform=amazon
amazon-ebs: platform_version=2
amazon-ebs: ruby=ruby 2.3.6p384 (2017-12-14 revision 61254) [x86_64-linux]
amazon-ebs: program_name=chef-solo worker: ppid=11910;start=23:39:40;
amazon-ebs: executable=/opt/chef/bin/chef-solo
amazon-ebs:
amazon-ebs: [2018-07-03T23:44:16+00:00] INFO: template[/etc/rsyslog.conf] sending restart action to service[rsyslog] (delayed)
amazon-ebs: [2018-07-03T23:44:16+00:00] INFO: Processing service[rsyslog] action restart (rsyslog::default line 94)
amazon-ebs: [2018-07-03T23:44:16+00:00] INFO: service[rsyslog] restarted
amazon-ebs: [2018-07-03T23:44:16+00:00] ERROR: Running exception handlers
amazon-ebs: [2018-07-03T23:44:16+00:00] ERROR: Exception handlers complete
amazon-ebs: [2018-07-03T23:44:16+00:00] FATAL: Stacktrace dumped to /tmp/packer-chef-solo/local-mode-cache/cache/chef-stacktrace.out
amazon-ebs: [2018-07-03T23:44:16+00:00] FATAL: Please provide the contents of the stacktrace.out file if you file a bug report
amazon-ebs: [2018-07-03T23:44:16+00:00] ERROR: execute[validate_config] (rsyslog::default line 40) had an error: Mixlib::ShellOut::ShellCommandFailed: Expected process to exit with [0], but received '1'
amazon-ebs: ---- Begin output of rsyslogd -N 1 -f /etc/rsyslog.conf ----
amazon-ebs: STDOUT:
amazon-ebs: STDERR: rsyslogd: version 8.24.0, config validation run (level 1), master config /etc/rsyslog.conf
amazon-ebs: rsyslogd: error during parsing file /etc/rsyslog.d/50-default.conf, on or before line 8: warnings occured in file '/etc/rsyslog.d/50-default.conf' around line 8 [v8.24.0 try http://www.rsyslog.com/e/2207 ]
amazon-ebs: ---- End output of rsyslogd -N 1 -f /etc/rsyslog.conf ----
amazon-ebs: Ran rsyslogd -N 1 -f /etc/rsyslog.conf returned 1
amazon-ebs: [2018-07-03T23:44:16+00:00] FATAL: Chef::Exceptions::ChildConvergeError: Chef run process exited unsuccessfully (exit code 1)
@blueben
Copy link
Author

blueben commented Jul 4, 2018

There appears to be an incorrect assumption in the default attributes, which looks for RHEL family distros lesser than version 6 and generates a configuration for older versions of rsyslog.

# rsyslog 3/4 do not support the new :omusrmsg:* format and need * instead
if node['platform_family'] == 'rhel' && node['platform_version'].to_i < 6
  default['rsyslog']['default_facility_logs']['*.emerg'] = '*'
end

This breaks because Amazon Linux does report as being in the RHEL platform_family and platform_version 2, however provides rsyslog version 8.24.0.

[root@xxx:~]$ cat /etc/system-release
Amazon Linux release 2 (2017.12) LTS Release Candidate

[root@xxx:~]$ ohai platform platform_family platform_version
[
  "amazon"
]
[
  "rhel"
]
[
  "2"
]

[root@xxx:~]$ rpm -qi rsyslog
Name        : rsyslog
Version     : 8.24.0
Release     : 12.amzn2
Architecture: x86_64
Install Date: Wed 10 Jan 2018 02:10:56 AM UTC
Group       : System Environment/Daemons
Size        : 1982902
License     : (GPLv3+ and ASL 2.0)
Signature   : RSA/SHA256, Tue 14 Nov 2017 08:49:16 PM UTC, Key ID 11cf1f95c87f5b1a
Source RPM  : rsyslog-8.24.0-12.amzn2.src.rpm
Build Date  : Thu 19 Oct 2017 05:40:42 PM UTC
Build Host  : build.amazon.com
Relocations : (not relocatable)
Packager    : Amazon Linux
Vendor      : Amazon Linux
URL         : http://www.rsyslog.com/

The most correct solution would be to check directly for the version of rsyslog available rather than using indirect and imprecise distro checks.

blueben pushed a commit to blueben/rsyslog that referenced this issue Jul 4, 2018
@tas50 tas50 changed the title rsyslog default configuration generated incorrectly on Amazon Linux rsyslog default configuration generated incorrectly on Amazon Linux 2 Jul 10, 2018
blueben pushed a commit to blueben/rsyslog that referenced this issue Sep 5, 2018
blueben pushed a commit to blueben/rsyslog that referenced this issue Sep 5, 2018
@github-actions
Copy link

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

@github-actions github-actions bot added the Stale This is marked as stale and will be closed shortly label Oct 22, 2020
@github-actions
Copy link

Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Stale This is marked as stale and will be closed shortly
Projects
None yet
Development

No branches or pull requests

1 participant