Logging chef-client output
You can obtain chef-client logs from the nodes when you use the IBM® Cloud Manager with OpenStack commands.
The IBM Cloud Manager with OpenStack commands log chef-client console output and service status output that is captured from each node on the Chef server in a central location. The log file name includes the node name, as well as, an integer time stamp. Up to 44 log files are kept for each node in the /var/log/icm-deployer/nodes folder on the Chef server. Each IBM Cloud Manager with OpenStack deployment or update command typically writes a minimum of 4 log files per node. Two are for the bootstrap (1 *.log and 1 *.console), and the final two are for the actual chef-client run (1 *.log and 1 *.console). HA deployments write more log files, up to 13 per node.
knife[:node_log_max_files] = 44
knife[:node_log_path] = '/var/log/icm-deployer/nodes'
These settings default in the IBM Cloud Manager with OpenStack command-line interface code to the preceding values shown above. The preceding values can be set in knife.rb, if the defaults are not adequate.
To turn of node logging, set knife[:node_log_max_files] = 0
- The detailed log file name is <node_name>_<timestamp>.log.
For example:
The detailed log file contains the low-level chef-client information.host.my.company.com_2014-10-23_06-56-24-314222499000.log
- The console log file name is <node_name>_<timestamp>.console.
For example:
The console log file contains the same high level chef-client information that is displayed to the terminal by the command. Each row in the file includes the time stamp of the high-level action and the number of milliseconds since the last high-level action.host.my.company.com_2014-10-23_06-56-24-314222499000.console
By default, up to 44 log files are saved for each node.
Logging chef-client output to a log file on the node itself can also be accomplished by specifying chef-client options when you issue one of the IBM Cloud Manager with OpenStack os manage deploy or os manage update commands. When chef-client writes to a log file, it does not affect its console output.
knife os manage update node host.my.company.com -P passw0rd -O '-l info -L /var/log/chef-client.log'
The -l chef-client
option is the log level (info is specified in the
preceding example). The -L chef-client option is
the log file location. "chef_client_options": ["-l info", "-L /var/log/chef-client.log"],
The
preceding options are passed to chef-client to cause it to perform info level
logging and store the log information in /var/log/chef-client.log.When forcing the chef-client to write to a log file, the output is not the same as that seen on the console. That console output is logged on the chef server as previously mentioned.
log_location "/var/log/chef-client.log"
verbose :info
log_level :info