Skip to content

Instantly share code, notes, and snippets.

@jtimberman
Created January 20, 2011 00:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jtimberman/787164 to your computer and use it in GitHub Desktop.
Save jtimberman/787164 to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'syslog_logger'
Chef::Log.logger = SyslogLogger.new('ruby-chef-client')
log_level :info
log_location STDOUT
chef_server_url "https://api.opscode.com/organizations/REDACTED"
validation_client_name "REDACTED-validator"
Chef::Log.info(Chef::Log.logger)
Chef::Config.from_file("/etc/chef/client.rb")
Chef::Log.info(Chef::Log.logger)
$ sudo chef-client
[Wed, 19 Jan 2011 17:14:42 -0700] INFO: Starting Chef Run (Version 0.9.12)
[Wed, 19 Jan 2011 17:14:43 -0700] INFO: Storing updated cookbooks/loggertest/recipes/default.rb in the cache.[Wed, 19 Jan 2011 17:14:43 -0700] INFO: #<Logger:0x7f70cf2ef288 @formatter=#<Mixlib::Log::Formatter:0x7f70cf2ef260 @datetime_format=nil>, @progname=nil, @default_formatter=#<Logger::Formatter:0x7f70cf2ef238 @datetime_format=nil>, @logdev=#<Logger::LogDevice:0x7f70cf2ef1e8 @dev=#<IO:0x7f70d39d2ad8>, @shift_size=nil, @shift_age=nil, @filename=nil, @mutex=#<Logger::LogDevice::LogDeviceMutex:0x7f70cf2ef198 @mon_waiting_queue=[], @mon_entering_queue=[], @mon_count=0, @mon_owner=nil>>, @level=1>
Jan 19 17:14:43 guineapig ruby-chef-client[12289]: #<SyslogLogger:0x7f70cf277350>
Jan 19 17:14:44 guineapig ruby-chef-client[12289]: Chef Run complete in 2.065848 seconds
Jan 19 17:14:44 guineapig ruby-chef-client[12289]: cleaning the checksum cache
Jan 19 17:14:44 guineapig ruby-chef-client[12289]: Running report handlers
Jan 19 17:14:44 guineapig ruby-chef-client[12289]: Report handlers complete
@jtimberman
Copy link
Author

logtest.rb is a recipe applied to the node

second output line in stdout is logtest.rb line 1.

all output in syslog is after loading the client.rb config file from logtest.rb line 3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment