My end goal: log the chef-client runs to file (rather than just STDOUT).
I found the
chef-client::config recipe and the
default['chef_client']['cron']['log_file'] attribute. When I include the
chef-client::config recipe in my test kitchen instance, test kitchen creates a
/etc/chef/client.rb file different than what I currently have in my non-dev environments (which created the
/etc/chef/client.rb file with the standard chef-client install but not from
chef_server_url "https://path/to/server" validation_client_name "my-custom-name" node_name "my-custom-node-name" trusted_certs_dir "/etc/chef/trusted_certs"
chef_server_url "chefzero://localhost:8889" client_fork true log_location "/var/log/chef/client.log" validation_client_name "chef-validator" verify_api_cert true node_name "default-ubuntu-1404" # Do no crash if a handler is missing / not installed yet begin rescue NameError => e Chef::Log.error e end Dir.glob(File.join("/etc/chef", "client.d", "*.rb")).each do |conf| Chef::Config.from_file(conf) end
My question: is there an easier way to add the
log_location variable to my
client.rb file than this recipe/attribute? I assume that if I choose to manage the
log_location attribute via the
chef-client::config recipe, I have to manage the other attributes via this recipe too (
validation_client_name, etc.) or they’ll be removed from my pre-existing
I’m running chef-client v 12.5.1.