Puppet 报表日志
每次在 Puppet 运行期间应用目录时,Puppet 都会创建一份关于其操作和您的基础架构的报表。Site24x7 AppLogs内置了对 Puppet 报表日志的支持。
入门
1. 登录您的 Site24x7 帐户。
2. 下载并安装Site24x7 服务器监控代理( Windows | Linux )。
3. 进入管理 > AppLogs > 日志配置文件并选择添加日志配置文件。
4. 输入配置文件名称。
5. 从选择日志类型下拉列表中,选择Puppet Report Logs。
- 示例日志和日志模式如下所示。
示例日志:
{"host": "ip-172-31-13-154.us-east-2.compute.internal","time": "2021-07-28T15:01:38.026099904+00:00","configuration_version": 1627484498,"transaction_uuid": "6775bf60-a3ae-4b80-a15e-c8e602af16da","report_format": 10,"puppet_version": "5.5.10","message": "Using configured environment 'production'","status": "changed","transaction_completed": true,"noop": false,"noop_pending": false,"environment": "production","level": "info","source": "Puppet","catalog_application": 0.01703704400006245,"title": "/tmp/it_works.txt","file": "/etc/puppet/code/environments/production/manifests/site.pp","line": 1,"resource": "File[/tmp/it_works.txt]","resource_type": "File","provider_used": "posix","containment_path": ["Stage[main]","Main","File[/tmp/it_works.txt]"],"evaluation_time": 0.004674063,"failed": false,"failed_to_restart": false,"changed": true,"out_of_sync": true,"skipped": false,"change_count": 1,"out_of_sync_count": 1,"events": [{"audited": false,"property": "ensure","previous_value": "absent","desired_value": "present","historical_value": null,"message": "defined content as '{md5}b7765335cba924c39fe20334d017677d'","name": "file_created","status": "success","time": "2021-07-28T15:01:38.503277773+00:00","redacted": null,"corrective_change": true}],"corrective_change": true} - 这些日志被分成多个字段,每个字段取其各自的值,然后上传到 Site24x7。
- 默认情况下,这是由 AppLogs for Puppet 报表日志标识的日志模式:
$host as Host$ $time:date:yyyy-MM-dd'T'HH:mm:ss.SX$ $configuration_version as ConfigVersion$ $transaction_uuid as TransUUID$ $report_format as ReportFormat$ $puppet_version as PuppetVersion$ $status as Status$ $environment as Environment$ $level as LogLevel$ $source as PuppetSource$ $catalog_application as CatalogApplication:decimal$ $title as Title$ $file as File$ $ line as Line$ $resource as Resource$ $resource_type as ResourceType$ $provider_used$ $containment_path$ $evaluation_time as EvaluationTime:decimal$ $failed as Failed$ $failed_to_restart$ $changed$ $out_of_sync as OutOfSync$ $skipped$ $change_count$ $ out_of_sync_count$ $events$ $corrective_change$ $message$ - 您可以添加自定义日志模式而不是默认模式。为此,请单击铅笔图标并指定您的模式。
6.从日志源下拉列表中,选择本地文件。
7. 默认使用以下路径作为文件源:
Linux:“/opt/puppetlabs/server/data/puppetserver/reports/*.yaml”、“/var/log/puppetlabs/puppetserver/reports/*. yaml"
- 默认情况下,Puppet 以 YAML 格式编写报表。Site24x7 AppLogs 代理会将这些条目转换为 JSON 格式并上传。
- 如果您的源路径与默认路径不同,请在要搜索日志的文件列表字段中指定它们。
8. 选择要收集的日志或日志 组
9. 点击保存。
仪表板
AppLogs 为每种日志类型创建一个专属仪表板,并默认显示一些小窗件。以下是 Puppet 报表日志仪表板上可用的小窗件列表:
- 总请求
- 跳过的资源
- 资源不同步
- 资源已更改
- 失败的资源
- 平均目录应用时间
- 环境活动
- Top节点
- 日志记录级别
- Puppet版本
- Top错误节点
- 顶部警告节点
- 错误率
- 主要错误
- 警告原因
- 警告率
- 资源状态
- 目录应用时间最慢的节点