<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Logging in Chef Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/logging-in-chef/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/logging-in-chef/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:49:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>Logging in Chef Explained</title>
		<link>https://www.scmgalaxy.com/tutorials/logging-in-chef-explained/</link>
					<comments>https://www.scmgalaxy.com/tutorials/logging-in-chef-explained/#comments</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Wed, 26 Jul 2017 12:22:56 +0000</pubDate>
				<category><![CDATA[Chef]]></category>
		<category><![CDATA[Chef Guide]]></category>
		<category><![CDATA[Chef recipe]]></category>
		<category><![CDATA[Chef Tutorials]]></category>
		<category><![CDATA[Logging in Chef]]></category>
		<category><![CDATA[Logs]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2017/07/26/logging-in-chef-explained/</guid>

					<description><![CDATA[<p>Chef Server All logs generated by the Chef server can be found in /var/log/opscode. Each service enabled on the system [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/logging-in-chef-explained/">Logging in Chef Explained</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><img fetchpriority="high" decoding="async" class="size-full wp-image-2845 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/logging-in-chef-explained.png" alt="logging-in-chef-explained" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/logging-in-chef-explained.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2017/07/logging-in-chef-explained-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<p><strong>Chef Server</strong><br />
All logs generated by the Chef server can be found in /var/log/opscode. Each service enabled on the system also has a sub-directory in which service-specific logs are located, typically found in /var/log/opscode/service_name.</p>
<p>The Chef server has built-in support for easily tailing the logs that are generated. To view all the logs being generated on the Chef server, enter the following command:<br />
&gt; chef-server-ctl tail</p>
<p><strong>To view logs for a specific service:</strong><br />
&gt; chef-server-ctl tail SERVICENAME<br />
where SERVICENAME should be replaced with name of the service for which log files will be viewed. SERVICENAME represents the name of any service that is listed after running the &#8220;&gt; chef-server-ctl service-list&#8221; subcommand.</p>
<p><strong>Another way to view log files is to use the system utility tail:</strong><br />
&gt; tail -50f /var/log/chef-server/opscode-chef/current<br />
&gt; tail -50f /var/log/opscode/opscode-chef/current</p>
<p><strong>Supervisor Logs</strong><br />
Supervisor logs are created and managed directly by the service supervisor, and are automatically rotated when a the current log file reaches 1,000,000 bytes. 10 log files are kept. The latest supervisor log is always located in /var/log/chef-server/service_name/current and rotated logs have a filename starting with @ followed by a precise tai64n timestamp based on when the file was rotated.</p>
<p>Supervisor logs are available for the following services:</p>
<ol>
<li>bifrost</li>
<li>bookshelf</li>
<li>nginx</li>
<li>opscode-erchef</li>
<li>opscode-expander</li>
<li>opscode-expander-reindexer</li>
<li>opscode-solr4</li>
<li>postgresql</li>
<li>rabbitmq</li>
<li>redis</li>
</ol>
<h3>nginx</h3>
<p>The nginx service creates both supervisor and administrator logs. The administrator logs contain both access and error logs for each virtual host utilized by the Chef server. Each of the following logs require external log rotation.</p>
<table border="1">
<colgroup>
<col width="13%" />
<col width="88%" /> </colgroup>
<thead valign="bottom">
<tr>
<th>Logs</th>
<th>Description</th>
</tr>
</thead>
<tbody valign="top">
<tr>
<td>/var/log/opscode/nginx/access.log</td>
<td>The Web UI and API HTTP access logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/error.log</td>
<td>The Web UI and API HTTP error logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/internal-account.access.log</td>
<td>The opscode-account internal load-balancer access logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/internal-account.error.log</td>
<td>The opscode-account internal load-balancer error logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/internal-authz.access.log</td>
<td>The opscode-authz internal load-balancer access logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/internal-authz.error.log</td>
<td>The opscode-authz internal load-balancer error logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/internal-chef.access.log</td>
<td>The opscode-chef and opscode-erchef internal load-balancer access logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/internal-chef.error.log</td>
<td>The opscode-chef and opscode-erchef internal load-balancer error logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/nagios.access.log</td>
<td>The nagios access logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/nagios.error.log</td>
<td>The nagios error logs.</td>
</tr>
<tr>
<td>/var/log/opscode/nginx/rewrite-port-80.log</td>
<td>The rewrite logs for traffic that uses HTTP instead of HTTPS.</td>
</tr>
</tbody>
</table>
<p>To follow the logs for the service:</p>
<div>
<div>
<pre> $ chef-server-ctl tail nginx</pre>
</div>
</div>
<p><strong>Chef Client</strong></p>
<p>Client.rb3 file might help you. Default value of log_location is STDOUT. You can give /path/to/log_location in place of this. You can locate this client.rb file in C:\chef\client.rb or /etc/chef/client.rb directories.</p>
<p>Use the verbose logging that is built into the chef-client:<br />
-l LEVEL, &#8211;log_level LEVEL<br />
The level of logging to be stored in a log file.<br />
-L LOGLOCATION, &#8211;logfile c<br />
The location of the log file. This is recommended when starting any executable as a daemon. Default value: STDOUT.</p>
<p><strong>Knife</strong><br />
Use the verbose logging that is built into knife:<br />
-V, &#8211;verbose<br />
Set for more verbose outputs. Use -VV for maximum verbosity.</p>
<p><strong>chef-solo</strong><br />
-l LEVEL, &#8211;log_level LEVEL<br />
The level of logging to be stored in a log file.</p>
<p>The Chef file and folder locations are different on Linux and Windows machines. This article explains the purpose of each file and the location.</p>
<h4>Summary</h4>
<table border="1" width="100%">
<tbody>
<tr>
<th></th>
<th>Linux</th>
<th>Windows</th>
</tr>
<tr>
<td>Cookbook location</td>
<td>/var/chef/cache/cookbooks</td>
<td> C:\chef\cache\cookbooks</td>
</tr>
<tr>
<td>Chef Client run log</td>
<td>/var/log/chef.log</td>
<td>First run only<br />
C:\chef\chef-client.log</td>
</tr>
<tr>
<td></td>
<td></td>
<td>Subsequent Chef client runs<br />
C:\chef\log\client.log</td>
</tr>
<tr>
<td>Error log</td>
<td>/var/chef/cache/chef-stacktrace.out</td>
<td>C:\chef\cache\chef-stacktrace.out</td>
</tr>
<tr>
<td>Ohai output</td>
<td>/var/chef/cache/failed-run-data.json</td>
<td>C:\chef\cache\failed-run-data.json</td>
</tr>
<tr>
<td>Recommended location for custom log files</td>
<td>/tmp/cheflog.log</td>
<td>C:\Logs\Chef\cheflog.log</td>
</tr>
<tr>
<td height="43">Chef Client configuration</td>
<td>/etc/chef/client.rb</td>
<td>C:\chef\client.rb</td>
</tr>
</tbody>
</table>
<p>&nbsp;</p>
<h4>When you test your cookbook in Test Kitchen</h4>
<p>The .kitchen.yml file contains the username to execute the Chef cookbook. It is specified under <strong>platforms</strong>:, <strong>transport</strong>:, <strong>username</strong>:</p>
<p>Use that value in place of <strong>USER-NAME-FROM-KITCHEN-YML</strong> below.</p>
<table border="1" width="100%">
<tbody>
<tr>
<th></th>
<th>Linux</th>
<th>Windows</th>
</tr>
<tr>
<td>Cookbook location</td>
<td>/tmp/kitchen/cookbooks<br />
/tmp/kitchen/cache/cookbooks</td>
<td> C:\Users\USER-NAME-FROM-KITCHEN-YML\AppData\Local\Temp\kitchen\cookbooks</td>
</tr>
<tr>
<td>Error log</td>
<td>/tmp/kitchen/cache/chef-stacktrace.out</td>
<td>C:\Users\USER-NAME-FROM-KITCHEN-YML\AppData\Local\Temp\kitchen\cache\chef-stacktrace.out</td>
</tr>
<tr>
<td>Ohai output</td>
<td>/tmp/kitchen/cache/failed-run-data.json</td>
<td>C:\Users\USER-NAME-FROM-KITCHEN-YML\AppData\Local\Temp\kitchen\cache\failed-run-data.json</td>
</tr>
<tr>
<td>Data bags</td>
<td>/tmp/kitchen/data_bags</td>
<td>C:\Users\USER-NAME-FROM-KITCHEN-YML\AppData\Local\Temp\kitchen\data_bags</td>
</tr>
</tbody>
</table>
<p>&nbsp;<br />
<strong>Cookbook location </strong></p>
<p>When the Chef recipes are executed, all cookbooks are stored on the node. You can examine the code to make sure your latest changes are reflected on the machine.</p>
<p><strong>The log of the Chef client run</strong></p>
<p>The output of the Chef cookbook execution is in the chef.log or chef-client.log file</p>
<p><strong>On Windows</strong></p>
<p><strong>The log of the first Chef Client run and subsequent runs are stored in different log files.</strong> After the initial Chef Client run, the rest of the log entries are collected in the second file.</p>
<p><strong>Stacktrace</strong></p>
<p>Chef saves information on the hard drive when scripts are executed. If there is a failure, the stack trace of the last error is saved in the <strong>chef-stacktrace.out</strong> file.</p>
<p><strong>Ohai output</strong></p>
<p>All the information that Ohai collects on the instance, is saved in the <strong>failed-run-data.json</strong>file, even if there is no error. It is a great resource to get the server specific values.</p>
<p><strong>Reference</strong></p>
<p><a href="https://docs.chef.io/server_logs.html" target="_blank" rel="noopener">https://docs.chef.io/server_logs.html</a><br />
<a href="https://docs.chef.io/debug.html" target="_blank" rel="noopener">https://docs.chef.io/debug.html</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/logging-in-chef-explained/">Logging in Chef Explained</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/logging-in-chef-explained/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
