puppetlabs/puppet · error · Puppet::Error

Invalid syslog facility

Error message

Invalid syslog facility %{str}

What it means

Guard error raised when initializing the syslog log destination: the value of the syslogfacility setting is looked up as a Syslog constant (LOG_<FACILITY>) and NameError is turned into this Puppet::Error. It means the configured facility name does not correspond to any facility the Syslog library knows.

Solutions

  1. Set syslogfacility to a valid facility name such as LOCAL0, LOCAL1, DAEMON, USER, or KERN
  2. Check for typos or unsupported facility names in puppet.conf
  3. Consult the Syslog library constants for the list of supported facilities
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at lib/puppet/util/log/destinations.rb:23 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of puppetlabs/puppet@e227c27540 (2026-08-21). Data as JSON: /api/errors/8ee80a4522d0af3d. Report an issue: GitHub.

Appendix: source

Thrown at lib/puppet/util/log/destinations.rb:23

    Puppet.features.syslog?
  end

  def close
    Syslog.close
  end

  def initialize
    Syslog.close if Syslog.opened?
    name = "puppet-#{Puppet.run_mode.name}"

    options = Syslog::LOG_PID | Syslog::LOG_NDELAY

    # XXX This should really be configurable.
    str = Puppet[:syslogfacility]
    begin
      facility = Syslog.const_get("LOG_#{str.upcase}")
    rescue NameError => e
      raise Puppet::Error, _("Invalid syslog facility %{str}") % { str: str }, e.backtrace
    end

    @syslog = Syslog.open(name, options, facility)
  end

  def handle(msg)
    # XXX Syslog currently has a bug that makes it so you
    # cannot log a message with a '%' in it.  So, we get rid
    # of them.
    if msg.source == "Puppet"
      msg.to_s.split("\n").each do |line|
        @syslog.send(msg.level, line.gsub("%", '%%'))
      end
    else
      msg.to_s.split("\n").each do |line|
        @syslog.send(msg.level, "(%s) %s" % [msg.source.to_s.delete("%"),
                                             line.gsub("%", '%%')])
      end

View on GitHub (pinned to e227c27540)