Skip to content

Instantly share code, notes, and snippets.

@sawanoboly
Created December 4, 2013 08:09
Show Gist options
  • Save sawanoboly/7783898 to your computer and use it in GitHub Desktop.
Save sawanoboly/7783898 to your computer and use it in GitHub Desktop.
chef-client log to syslog (chef-client '~> 11.4')
require 'syslog-logger'
Logger::Syslog.class_eval do
attr_accessor :sync, :formatter, :close
def write(msg)
data = msg.match(/(\[.+?\]) ([\w]+):(.*)$/)
self.send(data[2].downcase.to_sym, data[3])
end
end
log_level :info
log_location Logger::Syslog.new("chef-client", Syslog::LOG_DAEMON)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment