If you do puppet agent -t
for when agent runs in background, where is the log file where we can see the changes, other than on puppet dashboard.
I viewed puppet.conf and in main section I see logdir
, but no log file is created on that location.
If you do puppet agent -t
for when agent runs in background, where is the log file where we can see the changes, other than on puppet dashboard.
I viewed puppet.conf and in main section I see logdir
, but no log file is created on that location.
From the docs:
When running as a service, Puppet agent logs messages to syslog. Your syslog configuration dictates where these messages will be saved, but the default location is /var/log/messages on Linux, /var/log/system.log on Mac OS X, and /var/adm/messages on Solaris.
When started with the --logdest FILE option, Puppet agent logs to the file specified by FILE.
https://docs.puppet.com/puppet/4.8/services_agent_unix.html#running-puppet-agent-as-a-service
As Raul mentions, the last run report is saved as a yaml file under the statedir directory.
Depending on your OS and which version of Puppet your using, this could be in different locations.
For example, on my server with Puppet 4 installed:
$ tree $(puppet agent --configprint statedir)
/opt/puppetlabs/puppet/cache/state
├── classes.txt
├── graphs
│ ├── expanded_relationships.dot
│ ├── relationships.dot
│ └── resources.dot
├── last_run_report.yaml
├── last_run_summary.yaml
├── resources.txt
├── state.yaml
└── transactionstore.yaml
1 directory, 9 files
A great tool for reading this last report file is report-print. If there's a particular piece of information you need out of the last report, you could probably adapt some of the report-print code to make your own report printer.
You can also use what's known as report processor, which is when you write custom code to control the format and process the, such as posting to a Splunk server, Slack, Hipchat etc. A simple example would be store_json, which stores the reports as JSON instead of Yaml.
In Linux, take a look at system log (/var/log/messages
or journalctl
).
You should have a report of each execution, in .yaml
format inside /var/lib/puppet
This is an older question, but the accepted answer didn't help me so here is an alternative that others may find useful. If your puppet runs occurred a while ago, then its output may not appear in /var/log/messages
.
Instead, you can view the summary (and report) of the last puppet run on a node in /var/lib/puppet/state/last_run_summary.yaml
(and last_run_report.yaml
). The report is a full log of the previous run, while the summary is brief overview. They have information that you may not be able to get from messages
.
Windows Puppets logs file path: C:\ProgramData\PuppetLabs\puppet\cache\state
Here you will find a few files, the most useful of which I have found to be: last_run_report.yaml and last_run_summary.yaml
As of now, this path is valid for Puppet versions 6.18^