If you need information while troubleshooting, increase the log level for the Puppet agent service.
Version and installation information
Puppet version: 4.0 to latest
OS: *nix, Windows
Installation type: Agents
Solution
Increase the log level using a method that fits your issue.
Note: Agent logs include sensitive information, including domain names and custom facts. Review logs and remove sensitive information before sending them outside of your organization.
My issue occurs on every agent run
If your issue occurs during every agent run, increase the log level for a single manual agent run.
-
Add
-d
to the list of options for your agent run. You can output the logs to a file to make it easier to search the output or share with others:puppet agent -td > PuppetDebug.log
My issue is intermittent
When the issue is intermittent, increase the log level for all Puppet runs. You can do this by editing either puppet.conf
or the agent service configuration.
Editing puppet.conf
:
- Works for both *nix and Windows.
- Increases the log level for all agents regardless of the invocation method.
- Adds debug level information to reports sent to the primary server (formerly called master).
- Does not require any service restarts.
Editing the agent service configuration:
- Allows you to target specific nodes.
Edit Puppet.conf
On Windows nodes, puppet.conf
is located at %PROGRAMDATA%\PuppetLabs\puppet\etc
(usually C:\ProgramData\PuppetLabs\puppet\etc
).
On *nix nodes, puppet.conf
is located at $confdir/puppet.conf
(usually /etc/puppetlabs/puppet/puppet.conf
).
- On the target node, edit
puppet.conf
to addlog_level = debug
Edit the agent service configuration
On Windows nodes
-
On the target node, restart the agent service using the following command:
c:\>sc stop puppet && sc start puppet --debug --trace
On *nix nodes:
-
On the target node, edit the following file:
OS Location All *nix (except for Debian) /etc/sysconfig/puppet
Debian /etc/default/puppet
Add the following line to the end of the file:
PUPPET_EXTRA_OPTS=--log_level=debug
-
Restart the agent service:
puppet resource service puppet ensure=stopped
puppet resource service puppet ensure=running
Where are my logs?
The location of the logs depends on your OS.
-
On Windows platforms, they are available in Event Viewer.
- Select Windows Logs > Application.
-
On *nix platforms, the agent service logs messages to
syslog
:- On RHEL-based OS:
/var/log/messages
- On Mac OS X:
/var/log/system.log
- On Solaris:
/var/adm/messages
- On RHEL-based OS:
Troubleshooting for *nix platforms
When the log level is increased to debug in *nix, it might be suppressed by the syslog
process. In your logs, there is a lower level log output than expected and a message similar to the following:
Sep 26 07:05:58 puppet-agent journal: Suppressed 2367 messages from /system.slice/puppet.service
Resolve the issue by redirecting the logs to an output file.
-
On the target node, edit the following file:
OS Location All *nix (except for Debian) /etc/sysconfig/puppet
Debian /etc/default/puppet
Add the
--logdest
option to thePUPPET_EXTRA_OPT
line, for example:PUPPET_EXTRA_OPTS=--logdest=/var/log/puppetlabs/agent.log --log_level=debug
-
Restart the agent service:
puppet resource service puppet ensure=stopped
puppet resource service puppet ensure=running
Comments
0 comments
Please sign in to leave a comment.