gpt4 book ai didi

puppet - 用于查看 Puppet 代理所做的最后更改的日志文件

转载 作者:行者123 更新时间:2023-12-05 01:19:09 29 4
gpt4 key购买 nike

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

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

最佳答案

来自文档:

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

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

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

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

$ 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 .如果您需要上一份报告中的特定信息,您可以调整一些报告打印代码来制作您自己的报告打印机。

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

关于puppet - 用于查看 Puppet 代理所做的最后更改的日志文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41256311/

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com