日志文件以查看 puppet 代理所做的最后更改 [英] Log file to view last changes made by puppet agent

查看:37
本文介绍了日志文件以查看 puppet 代理所做的最后更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果您为代理在后台运行时执行 puppet agent -t,那么我们可以查看更改的 日志文件 在哪里,而不是在 puppet 仪表板上.

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.

我查看了 puppet.conf 并在主要部分中看到了 logdir,但没有在该位置创建日志文件.

I viewed puppet.conf and in main section I see logdir, but no log file is created on that location.

推荐答案

来自文档:

作为服务运行时,Puppet 代理将消息记录到系统日志.你的syslog 配置规定了这些消息的保存位置,但是Linux 上的默认位置是/var/log/messages,在 Mac OS X 上为/var/log/system.log,在 Solaris 上为/var/adm/messages.

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.

当使用 --logdest FILE 选项启动时,Puppet 代理会记录到由 FILE 指定的文件.

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

正如 Raul 提到的,上次运行报告保存为 yaml 文件在 stateir 目录下.

As Raul mentions, the last run report is saved as a yaml file under the statedir directory.

根据您的操作系统和您使用的 Puppet 版本,这可能位于不同的位置.

Depending on your OS and which version of Puppet your using, this could be in different locations.

例如,在我安装了 Puppet 4 的服务器上:

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

阅读最后一份报告文件的一个很好的工具是report-print.如果您需要从上一份报告中获取特定信息,您可能可以调整一些报告打印代码来制作您自己的报告打印机.

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.

您还可以使用所谓的报表处理器,即当您编写自定义代码来控制格式和处理格式时,例如发布到 Splunk 服务器、Slack、Hipchat 等.一个简单的例子是 store_json,它将报告存储为 JSON 而不是 Yaml.

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.

这篇关于日志文件以查看 puppet 代理所做的最后更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆