{"record":{"id":"8ee80a4522d0af3d","repo":"puppetlabs/puppet","slug":"invalid-syslog-facility-str","errorCode":null,"errorMessage":"Invalid syslog facility %{str}","messagePattern":"Invalid syslog facility %(.+?)","errorType":"exception","errorClass":"Puppet::Error","httpStatus":null,"severity":"error","filePath":"lib/puppet/util/log/destinations.rb","lineNumber":23,"sourceCode":"    Puppet.features.syslog?\n  end\n\n  def close\n    Syslog.close\n  end\n\n  def initialize\n    Syslog.close if Syslog.opened?\n    name = \"puppet-#{Puppet.run_mode.name}\"\n\n    options = Syslog::LOG_PID | Syslog::LOG_NDELAY\n\n    # XXX This should really be configurable.\n    str = Puppet[:syslogfacility]\n    begin\n      facility = Syslog.const_get(\"LOG_#{str.upcase}\")\n    rescue NameError => e\n      raise Puppet::Error, _(\"Invalid syslog facility %{str}\") % { str: str }, e.backtrace\n    end\n\n    @syslog = Syslog.open(name, options, facility)\n  end\n\n  def handle(msg)\n    # XXX Syslog currently has a bug that makes it so you\n    # cannot log a message with a '%' in it.  So, we get rid\n    # of them.\n    if msg.source == \"Puppet\"\n      msg.to_s.split(\"\\n\").each do |line|\n        @syslog.send(msg.level, line.gsub(\"%\", '%%'))\n      end\n    else\n      msg.to_s.split(\"\\n\").each do |line|\n        @syslog.send(msg.level, \"(%s) %s\" % [msg.source.to_s.delete(\"%\"),\n                                             line.gsub(\"%\", '%%')])\n      end","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/puppetlabs/puppet/blob/e227c27540975c25aa22d533a52424a9d2fc886a/lib/puppet/util/log/destinations.rb#L5-L41","documentation":"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.","triggerScenarios":"Thrown at lib/puppet/util/log/destinations.rb:23 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Set syslogfacility to a valid facility name such as LOCAL0, LOCAL1, DAEMON, USER, or KERN","Check for typos or unsupported facility names in puppet.conf","Consult the Syslog library constants for the list of supported facilities"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"e227c27540975c25aa22d533a52424a9d2fc886a","analyzedAt":"2026-08-21T20:49:46.650Z","contentChangedAt":"2026-08-21T20:49:46.650Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}