robertdebock / ansible-role-rsyslog

Install and configure rsyslog on your system.
https://robertdebock.nl/
Apache License 2.0
36 stars 40 forks source link

Support specifying no rsyslog_mods #11

Open chancez opened 3 years ago

chancez commented 3 years ago

Proposed feature

Currently the assertions check if rsyslog_mods is defined/empty, and fails if it there isn't at least 1 module loaded. However, this validation seems unnecessary none of the allowed rsyslog_mods are strictly required.

I'm using rsyslog purely as a receiver of logs from other hosts to be forwarded to another log processing tool.

I'm using journald to provide /dev/log so I don't need immuxsock. I don't want to use imjournal because I don't want the host's journal logs to go to rsyslog. imklog and immark aren't really needed for me either.

I propose the validation on rsyslog_mods is either removed or changed to allow specifying an empty list.

chancez commented 3 years ago

Also, when immuxsocket isn't specified, you get this error:

invalid or yet-unknown config file command 'OmitLocalLogging'

because https://github.com/robertdebock/ansible-role-rsyslog/blob/master/templates/legacy_rsyslog.conf.j2#L40 is set when the module isnt loaded, but it's an option that only applies when that module is loaded.

isuftin commented 2 years ago

Seeing a similar issue when only including imjournal

Mar  2 16:32:16 vagrant-centos-7-vagrant-centos-7-stig systemd: Starting System Logging Service...
Mar  2 16:32:16 vagrant-centos-7-vagrant-centos-7-stig rsyslogd: [origin software="rsyslogd" swVersion="8.24.0-57.el7_9.1" x-pid="5699" x-info="http://www.rsyslog.com"] start
Mar  2 16:32:16 vagrant-centos-7-vagrant-centos-7-stig rsyslogd: invalid or yet-unknown config file command 'SystemLogSocketName' - have you forgotten to load a module? [v8.24.0-57.el7_9.1 try http://www.rsyslog.com/e/3003 ]
Mar  2 16:32:16 vagrant-centos-7-vagrant-centos-7-stig rsyslogd: invalid or yet-unknown config file command 'OmitLocalLogging' - have you forgotten to load a module? [v8.24.0-57.el7_9.1 try http://www.rsyslog.com/e/3003 ]
Mar  2 16:32:16 vagrant-centos-7-vagrant-centos-7-stig systemd: Started System Logging Service.

Everything still seems to work though

isuftin commented 2 years ago

@chancez - I know this issue is now years old but I was able to get around this in a hacky way...

rsyslog_rsyslog_d_files:
  # We have to do it this way because of:
  # https://github.com/robertdebock/ansible-role-rsyslog/issues/11
  # https://github.com/robertdebock/ansible-role-rsyslog/pull/12
  - omit_local_logging_fix:
      content: $OmitLocalLogging on