Rsyslog
Development repository for the rsyslog cookbook
Install / Use
/learn @sous-chefs/RsyslogREADME
rsyslog Cookbook
Installs and configures rsyslog to replace syslogd for client and/or server use. By default, the service will be configured to log to files on local disk. See the Recipes and Examples sections for other uses.
Maintainers
This cookbook is maintained by the Sous Chefs. The Sous Chefs are a community of Chef cookbook maintainers working together to maintain important cookbooks. If you’d like to know more please visit sous-chefs.org or come chat with us on the Chef Community Slack in #sous-chefs.
Requirements
Platforms
- CentOS 8+ (incl. Rocky & Alma)
- Debian 11+
- Fedora
- OpenSUSE Leap
- SmartOS / OmniOS
- Ubuntu 20.04+
Chef
- Chef 15.3+
Other
To use the recipe[rsyslog::client] recipe, you'll need to set up the rsyslog.server_search or rsyslog.server_ip attributes. See the Recipes and Examples sections below.
Attributes
See attributes/default.rb for default values.
node['rsyslog']['log_dir']- If the node is an rsyslog server, this specifies the directory where the logs should be stored.node['rsyslog']['working_dir']- The temporary working directory where messages are bufferednode['rsyslog']['working_dir_mode']- The temporary working directory access modenode['rsyslog']['server']- Determined automatically and set to true on the server.node['rsyslog']['server_ip']- If not defined then search will be used to determine rsyslog server. Default isnil. This can be a string or an array.node['rsyslog']['server_search']- Specify the criteria for the server search operation. Default isrole:loghost.node['rsyslog']['protocol']- Specify whether to useudportcpfor remote loghost. Default istcp. To use both specify both in a string e.g. 'udptcp'.node['rsyslog']['bind']- Specify the address to which the server should be listening; only use withnode['rsyslog']['protocol'] = 'udp'because the feature does not work with thetcpprotocol (more info).node['rsyslog']['port']- Specify the port which rsyslog should connect to a remote loghost.node['rsyslog']['remote_logs']- Specify whether to send all logs to a remote server (client option). Default istrue.node['rsyslog']['per_host_dir']- "PerHost" directories for template statements in35-server-per-host.conf. Default value is the previous cookbook version's value, to preserve compatibility. See server recipe below.node['rsyslog']['priv_seperation']- Whether to use privilege separation or not.node['rsyslog']['priv_user']- User to run as when using privilege separation. Defult isnode['rsyslog']['user']node['rsyslog']['priv_group']- Group to run as when using privilege separation. Defult isnode['rsyslog']['group']node['rsyslog']['max_message_size']- Specify the maximum allowed message size. Default is 2k. Specifying 'nil' or 'false' will not generate the associated directive in the configuration at all.node['rsyslog']['user']- Who should own the configuration files and directoriesnode['rsyslog']['group']- Who should group-own the configuration files and directoriesnode['rsyslog']['dir_owner']- Who should own the log directoriesnode['rsyslog']['dir_group']- Who should group-own the log directoriesnode['rsyslog']['config_dir']['mode']- Mode that should be set when creating the configuration directorynode['rsyslog']['file_create_mode']- Mode that should be set when creating log filesnode['rsyslog']['dir_create_mode']- Mode that should be set when creating log directoriesnode['rsyslog']['umask']- Specify the processes umasknode['rsyslog']['defaults_file']- The full path to the defaults/sysconfig file for the service.node['rsyslog']['package_name']- Specify rsyslog package namenode['rsyslog']['service_name']- The platform-specific name of the servicenode['rsyslog']['preserve_fqdn']- Value of the$PreserveFQDNconfiguration directive in/etc/rsyslog.conf. Default is 'off' for compatibility purposes.node['rsyslog']['high_precision_timestamps']- Enable high precision timestamps, instead of the "old style" format. Default is 'false'.node['rsyslog']['repeated_msg_reduction']- Value of$RepeatedMsgReductionconfiguration directive in/etc/rsyslog.conf. Default is 'on'node['rsyslog']['logs_to_forward']- Specifies what logs should be sent to the remote rsyslog server. Default is all ( . ).node['rsyslog']['default_log_dir']- log directory used in50-default.conftemplate, defaults to/var/lognode['rsyslog']['default_facility_logs']- Hash containing log facilities and destinations used in50-default.conftemplate.node['rsyslog']['default_file_template']- The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for local log files.node['rsyslog']['default_remote_template']- The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for sending to remote servers.node['rsyslog']['templates']- Allows a user to specify a dynamic filename and the format of the logsnode['rsyslog']['rate_limit_interval']- Value of the $SystemLogRateLimitInterval configuration directive in/etc/rsyslog.conf. Default is nil, leaving it to the platform default.node['rsyslog']['rate_limit_burst']- Value of the $SystemLogRateLimitBurst configuration directive in/etc/rsyslog.conf. Default is nil, leaving it to the platform default.node['rsyslog']['action_queue_max_disk_space']- Max amount of disk space the disk-assisted queue is allowed to use (more info).node['rsyslog']['tcp_max_sessions']- Maximum number of TCP sessions (ie. clients) this rsyslog server will handle. Default is 200.node['rsyslog']['enable_tls']- Whether or not to enable TLS encryption. When enabled, forces protocol totcp. Default isfalse.node['rsyslog']['tls_driver']- Defaults toossl.node['rsyslog']['tls_ca_file']- Path to TLS CA file. Required for both server and clients.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 toanon(no validation).node['rsyslog']['tls_permitted_peer']- Value forActionSendStreamDriverPermittedPeer, it narrows the list of the allowed hosts. Works with TLS only. Defaults tonil.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 targetsnode['rsyslog']['additional_directives']- Hash of additional directives and their values to place in the main rsyslog config filenode['rsyslog']['local_host_name']- permits to overwrite the system hostname with the one specified in the directivenode['rsyslog']['default_conf_file']- If false it skips the creation of default configuration file 50-default.confnode['rsyslog']['server_per_host_template']- Template to use in thersyslog::serverrecipe when creating the35-server-per-host.conffilenode['rsyslog']['server_per_host_cookbook']- Cookbook name to get thenode['rsyslog']['server_per_host_template']template fromnode['rsyslog']['imfile']['KEY']- Setimfilemodule parameters of labelKEYto value. e.g.PollingInterval. Consult rsyslog documentation for valid entries.node['rsyslog']['modules']- Array of modules to load in the main rsyslog config filexnode['rsyslog']['<module>_directives']- Hash of module directives and their values that apply to eachnode['rsyslog']['modules']when the module is loaded
Recipes
default
Installs the rsyslog package, manages the rsyslog service and sets up basic configuration for a standalone machine.
client
Includes recipe[rsyslog].
Uses node['rsyslog']['server_ip'] or Chef search (in that precedence order) to determine the remote syslog server's IP address. If search is used, the search query will look for the first ipaddress returned from the criteria specified in node['rsyslog']['server_search'].
You can use node['rsyslog']['custom_config'] to define custom entries for sending logs to remote servers. Available attributes:
'server': Ip/hostname of remote syslog server (Required)
'port': Port to send logs to
'logs': Syslog log facilities to send (auth, authpriv, daemon, etc)
'protocol': Can be tcp or udp
'remote_template': Rsyslog template used for the messages
Example:
node['rsyslog']['custom_remote'] = [
{ 'server' => '10.10.4.4', 'port' => '567', 'logs' => 'auth.*,mail.*', 'protocol' => 'udp', 'remote_template' => 'RSYSLOG_Sy
