Log file to view last changes made by puppet agent

懵懂的女人 提交于 2019-12-24 08:23:41

问题


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.


回答1:


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.




回答2:


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



来源:https://stackoverflow.com/questions/41256311/log-file-to-view-last-changes-made-by-puppet-agent

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!