Caddy 访问日志
Caddy 是一个强大的、企业级的、开源的 Web 服务器,具有用 Go 编写的自动 HTTPS。CADDY访问日志可以根据定义的规则集收听并记录所有基于审核的事件。site24x7本地支持Caddy访问日志。
入门
1. 登录您的 Site24x7 帐户。
2. 下载并安装Site24x7 服务器监控代理( Windows | Linux )。
3. 进入管理 > AppLogs > 日志配置文件并选择添加日志配置文件。
4. 输入配置文件名称。
5.从选择日志类型下拉列表中选择Caddy 访问日志。
- 示例日志和日志模式如下所示。
Sample logs:
{"level":"info","ts":"1585597114.7687502", "logger":"http.log.access","msg":"handled request", "request": {"method":"GET", "uri":"/", "proto":"HTTP/2.0", "remote_addr":"127.0.0.1:50876", "host":"example.com","headers":{"User-Agent":["curl/7.64.1"],"Accept":["*/*"]},"tls":{"resumed":false,"version":771,"ciphersuite":49196,"proto":"h2","proto_mutual":true,"server_name":"example.com"}},"latency":0.000014711,"size":2326,"status":200,"resp_headers":{"Server":["Caddy"],"Content-Type":["text/html"]}}
{"level":"info","ts":"1585597114.7687502", "logger":"http.log.access","msg":"handled request", "request": {"method":"GET", "uri":"/", "proto":"HTTP/2.0", "remote_addr":"127.0.0.1:50876", "host":"example.com","headers":{"User-Agent":["curl/7.64.1"],"Accept":["*/*"]},"tls":{"resumed":false,"version":771,"ciphersuite":49196,"proto":"h2","proto_mutual":true,"server_name":"example.com"}},"latency":0.000014711,"size":2326,"status":200,"resp_headers":{"Server":["Caddy"],"Content-Type":["text/html"]}}
{"level":"info","ts":"1585597114.7687502", "logger":"http.log.access","msg":"handled request", "request": {"method":"GET", "uri":"/", "proto":"HTTP/2.0", "remote_addr":"127.0.0.1:50876", "host":"example.com","headers":{"User-Agent":["curl/7.64.1"],"Accept":["*/*"]},"tls":{"resumed":false,"version":771,"ciphersuite":49196,"proto":"h2","proto_mutual":true,"server_name":"example.com"}},"latency":0.000014711,"size":2326,"status":200,"resp_headers":{"Server":["Caddy"],"Content-Type":["text/html"]}}
此日志分为多个字段,每个字段取其各自的值,然后上传到 Site24x7。 - 您还可以添加自定义日志模式,而不是默认的日志模式。为此,请单击铅笔图标并指定您的模式。
6.选择本地文件作为日志源。
7、默认使用以下路径作为文件源:
Linux:"/opt/caddy/logs/*access.log,/home/*/caddy/logs/*access.log,C:\caddy\logs \*access.log"
- 如果您的源路径与默认路径不同,请在要搜索日志的文件列表字段中指定它。
8. 选择监视器或监视器组来收集日志。
9. 点击保存。
仪表板
AppLogs 为每种日志类型创建一个专属仪表板,并默认显示一些小窗件。以下是 Caddy 访问日志仪表板中可用的小窗件列表:
- 总请求
- 平均响应时间
- 平均响应大小
- 失败的请求
- 前 20 个失败的请求
- 请求趋势
- 前 10 名客户端 IP
- 状态码统计
- 响应时间统计
- 前 10 个成功的请求
- 前 10 个最慢的请求
- 前 50 个成功请求
- 前 10 个最慢的请求
相关日志类型