Search code examples
amazon-ec2chef-infraknife

Setting the Chef log level in knife ec2 when creating a server


I'm looking for the correct way to set chef-client's log level when creating a server using knife ec2.

My initial thought was setting the log level configuration in my knife.rb file like this:

log_level                :debug

This didn't result in any visible change in the log level.

I also tried turning on the -VV option in knife ec2, but that just results in verbose output from knife ec2 itself.

When I run chef-client directly after logging onto the server, I can get debug information with no problems using:

sudo chef-client -l debug

That would be sufficient, but I'm investigating an underlying problem that only occurs on the initial server bootstrap.


Solution

  • Currently the default bootstrap templates always set the default :auto log level to the node. There is at least one ticket that seems to be related.

    So your only option now is to create your own bootstrap template that adds log_level :debug to /etc/chef/client.rb. You can copy and modify e.g. the default "chef-full" template and then pass it as a parameter to knife.