Adoptable Cookbooks List

Looking for a cookbook to adopt? You can now see a list of cookbooks available for adoption!
List of Adoptable Cookbooks

Supermarket Belongs to the Community

Supermarket belongs to the community. While Chef has the responsibility to keep it running and be stewards of its functionality, what it does and how it works is driven by the community. The chef/supermarket repository will continue to be where development of the Supermarket application takes place. Come be part of shaping the direction of Supermarket by opening issues and pull requests or by joining us on the Chef Mailing List.

Select Badges

Select Supported Platforms

Select Status


rsyslog (82) Versions 1.13.0

Installs and configures rsyslog

cookbook 'rsyslog', '= 1.13.0', :supermarket
cookbook 'rsyslog', '= 1.13.0'
knife supermarket install rsyslog
knife supermarket download rsyslog
Quality 100%

rsyslog Cookbook

Build Status

Installs and configures rsyslog to replace sysklogd 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.



Tested on:
- Ubuntu 10.04+
- RedHat 5+
- Fedora 19+
- OmniOS r151006c


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.


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 buffered
  • node['rsyslog']['server'] - Determined automaticaly and set to true on the server.
  • node['rsyslog']['server_ip'] - If not defined then search will be used to determine rsyslog server. Default is nil. This can be a string or an array.
  • node['rsyslog']['server_search'] - Specify the criteria for the server search operation. Default is role:loghost.
  • node['rsyslog']['protocol'] - Specify whether to use udp or tcp for remote loghost. Default is tcp.
  • node['rsyslog']['port'] - Specify the port which rsyslog should connect to a remote loghost.
  • node['rsyslog']['remote_logs'] - Specify wether to send all logs to a remote server (client option). Default is true.
  • node['rsyslog']['per_host_dir'] - "PerHost" directories for template statements in 35-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 seperation or not.
  • node['rsyslog']['max_message_size'] - Specify the maximum allowed message size. Default is 2k.
  • node['rsyslog']['user'] - Who should own the configuration files and directories
  • node['rsyslog']['group'] - Who should group-own the configuration files and directories
  • node['rsyslog']['defaults_file'] - The full path to the defaults/sysconfig file for the service.
  • node['rsyslog']['service_name'] - The platform-specific name of the service
  • node['rsyslog']['preserve_fqdn'] - Value of the $PreserveFQDN configuration 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 $RepeatedMsgReduction configuration 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 in 50-default.conf template, defaults to /var/log
  • node['rsyslog']['default_facility_logs'] - Hash containing log facilities and destinations used in 50-default.conf template.
  • node['rsyslog']['default_file_template'] - The name of a pre-defined log format template (ie - RSYSLOG_FileFormat), used for local log files.
  • node['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']['enable_tls'] - Whether or not to enable TLS encryption. When enabled, forces protocol to tcp. Default is false.
  • 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 to anon (no validation).
  • 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']['additional_directives'] - Hash of additional directives and their values to place in the main rsyslog config file



Installs the rsyslog package, manages the rsyslog service and sets up basic configuration for a standalone machine.


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'].

If the node itself is a rsyslog server ie it has rsyslog.server set to true then the configuration is skipped.

If the node had an /etc/rsyslog.d/35-server-per-host.conf file previously configured, this file gets removed to prevent duplicate logging.

Any previous logs are not cleaned up from the log_dir.


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 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.

The log_dir will be concatenated with per_host_dir to store the logs for each client. Modify the attribute to have a value that is allowed by rsyslogs template matching values, see the rsyslog documentation for this.

Directory structure:

<%= @log_dir %>/<%= @per_host_dir %>/"logfile"

For example for the system with hostname www:


For example, to change this to just the hostname, set the attribute node['rsyslog']['per_host_dir'] via a role:

"rsyslog" => { "per_host_dir" => "%HOSTNAME%" }

At this time, the server can only listen on UDP or TCP.


Use recipe[rsyslog] to install and start rsyslog as a basic configured service for standalone systems.

Use recipe[rsyslog::client] to have nodes log to a remote server (which is found via the server_ip attribute or by the recipe's search call -- see client)

Use recipe[rsyslog::server] to set up a rsyslog server. It will listen on node['rsyslog']['port'] protocol node['rsyslog']['protocol'].

If you set up a different kind of centralized loghost (syslog-ng, graylog2, logstash, etc), you can still send log messages to it as long as the port and protocol match up with the server software. See Examples


A base role (e.g., roles/base.rb), applied to all nodes so they are syslog clients:

name "base"
description "Base role applied to all nodes

Then, a role for the loghost (should only be one):

name "loghost"
description "Central syslog server"

By default this will set up the clients search for a node with the loghost role to talk to the server on TCP port 514. Change the protocol and port rsyslog attributes to modify this.

If you want to specify another syslog compatible server with a role other than loghost, simply fill free to use the server_ip attribute or the server_search attribute.

Example role that sets the per host directory:

name "loghost"
description "Central syslog server"
  "rsyslog" => { "per_host_dir" => "%HOSTNAME%" }

Default rsyslog options are rendered for RHEL family platforms, in /etc/rsyslog.d/50-default.conf
with other platforms using a configuration like Debian family defaults. You can override these
log facilities and destinations using the rsyslog['default_facility_logs'] hash.

name "facility_log_example"
  "rsyslog" => {
    "facility_logs" => {
      '*.info;mail.none;authpriv.none;cron.none' => "/var/log/messages",
      'authpriv' => '/var/log/secure',
      'mail.*' => '-/var/log/maillog',
      '*.emerg' => '*'


This section details "quick development" steps. For a detailed explanation, see [[]].

  1. Clone this repository from GitHub:

    $ git clone

  2. Create a git branch

    $ git checkout -b my_bug_fix

  3. Install dependencies:

    $ bundle install

  4. Make your changes/patches/fixes, committing appropiately

  5. Write tests

  6. Run the tests:

    • bundle exec foodcritic -f any .
    • bundle exec rspec
    • bundle exec rubocop
    • bundle exec kitchen test

In detail:
- Foodcritic will catch any Chef-specific style errors
- RSpec will run the unit tests
- Rubocop will check for Ruby-specific style errors
- Test Kitchen will run and converge the recipes

License & Authors

Copyright:: 2009-2014, Chef Software, Inc

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
See the License for the specific language governing permissions and
limitations under the License.

Dependent cookbooks

This cookbook has no specified dependencies.

Contingent cookbooks

al_agents Applicable Versions
alphard-chef-loggly Applicable Versions
bluepill Applicable Versions
deis Applicable Versions
elkstack Applicable Versions
logentries-rsyslog Applicable Versions
loggly-rsyslog Applicable Versions
loggly_rsyslog_ng Applicable Versions
mw_server_base Applicable Versions
papertrail-rsyslog Applicable Versions
paramount Applicable Versions
platformstack Applicable Versions
server-base Applicable Versions
spartan_loggly_rsyslog Applicable Versions
stig Applicable Versions
sumologic-syslog Applicable Versions
tgw_uwsgi Applicable Versions

rsyslog Cookbook CHANGELOG

This file is used to list changes made in each version of the rsyslog cookbook.

v1.13.0 (2014-11-25)

  • Rsyslog's working directory is now an attribute and is set to the appropriate directory on RHEL based distros
  • The working directory is now 0700 vs 0755 for additional security
  • Add the ActionQueueMaxDiskSpace directive with a default of 1GB to prevent out of disk events during large buffering
  • Updated RHEL / Fedora facilities to match those shipped by the distros
  • Updated modules to match those used by journald (systemd) on Fedora 19+ and CentOS 7
  • Added an attribute additional_directives to pass a hash of configs. This is currently only being used to pass directives necessary for journald support on RHEL 7 / Fedora 19+
  • Added basic SUSE support
  • Fixed logic that prevented Ubuntu from properly dropping privileges in Ubuntu >= 11.04
  • Removed references to rsyslog v3 in the config template
  • Added a chefignore file
  • Updated Gemfile with newer releases of Test Kitchen, Rubocop, and Berkshelf
  • Added Fedora 20, Debian 6/7, CentOS 7, and Ubuntu 12.04/14.04 to the Test Kitchen config
  • Removed an attribute that was in the Readme twice
  • Updated Travis to Ruby 2.1.1 to better match Chef 12
  • Updated the Berksfile to point to Supermarket
  • Refactored the specs to be more dry

v1.12.2 (2014-02-28)

Fixing bug fix in rsyslog.conf

v1.12.0 (2014-02-27)

  • [COOK-4021] Allow specifying default templates for local and remote
  • [COOK-4126] rsyslog cookbook fails restarts due to not using upstart

v1.11.0 (2014-02-19)


  • COOK-4256 - Fix syntax errors in default.conf on rhel

New Feature

  • COOK-4022 - Add use_local_ipv4 option to allow selecting internal interface on cloud systems
  • COOK-4018 - rsyslog TLS encryption support


No change. Version bump for toolchain.


New Feature

  • COOK-4021 - Allow specifying default templates for local and remote



New Feature


  • COOK-3609 - Add actionqueue to remote rsyslog configurations




  • COOK-3573 - Add Test Kitchen, Specs, and Travis CI

New Feature



  • COOK-3253 - Enable repeated message reduction
  • COOK-3190 - Allow specifying which logs to send to remote server
  • COOK-2355 - Support forwarding events to more than one server


New Feature

  • [COOK-2831]: enable high precision timestamps


  • [COOK-2377]: calling has adverse affects on nodes relying on a searched node's ohai attributes
  • [COOK-2521]: rsyslog cookbook incorrectly sets directory ownership to rsyslog user
  • [COOK-2540]: Syslogd needs to be disabled before starting rsyslogd on RHEL 5


  • [COOK-2356]: rsyslog service supports status. Service should use it.
  • [COOK-2357]: rsyslog cookbook copies in wrong defaults file on Ubuntu !9.10/10.04


  • [COOK-2141] - Add $PreserveFQDN configuration directive


  • [COOK-1877] - RHEL 6 support and refactoring


  • [COOK-1189] - template change does not restart rsyslog on Ubuntu

This actually went into 1.2.0 with action :reload, but that change has been reverted and the action is back to :restart.


  • [COOK-1678] - syslog user does not exist on debian 6.0 and ubuntu versions lower than 11.04
  • [COOK-1650] - enable max message size configuration via attribute


Changes from COOK-1167:

  • More versatile server discovery - use the IP as an attribute, or use search (see README)
  • Removed cron dependency.
  • Removed log archival; logrotate is recommended.
  • Add an attribute to select the per-host directory in the log dir
  • Works with Chef Solo now.
  • Set debian/ubuntu default user and group. Drop privileges to syslog.adm.


  • [COOK-836] - use an attribute to specify the role to search for instead of relying on the rsyslog['server'] attribute.
  • Clean up attribute usage to use strings instead of symbols.
  • Update this README.
  • Better handling for chef-solo.

Foodcritic Metric

1.13.0 passed this metric