Howto setting log options in /etc/chef/client.rb at a Knife bootstrap


#1

Hi,

I would like to set the options in the /etc/chef/client.rb file at a knife bootstrap so that first client run are loggt too.
The options I want to set are:

log_level :info
log_location "/var/log/chef-client_run.log"
verbose_logging true

Is this possible?

Thanks

Oleg


#2

On Wed, Nov 28, 2012 at 1:06 PM, Oleg Volotov oleg.volotov@gmx.de wrote:

Hi,

I would like to set the options in the /etc/chef/client.rb file at a knife
bootstrap so that first client run are loggt too.

I think your best bet is to add the chef-client cookbook to the run list
and let it update the client.rb.


#3

On Wednesday, November 28, 2012 at 4:57 AM, Andrea Campi wrote:

On Wed, Nov 28, 2012 at 1:06 PM, Oleg Volotov <oleg.volotov@gmx.de (mailto:oleg.volotov@gmx.de)> wrote:

Hi,

I would like to set the options in the /etc/chef/client.rb file at a knife bootstrap so that first client run are loggt too.

I think your best bet is to add the chef-client cookbook to the run list and let it update the client.rb.
If you want to get these options picked up by the bootstrap run, you’ll need to customize the bootstrap template (which generates the script that knife bootstrap runs on the remote system). Currently, there are no options for log location in the bootstrap code, so you’d want to replace the call to the config_content method in the template with your desired config, or replace the start_chef method with something that runs chef-client -L /path/to/log.

The links below should get you started.

http://wiki.opscode.com/display/chef/Custom+Knife+Bootstrap+Script
https://github.com/opscode/chef/blob/master/lib/chef/knife/bootstrap/chef-full.erb


Daniel DeLeo