Appearance
logs —— 查询日志
查询 CertiMan 的统一日志。CertCloud 命令、ACME 命令与定时任务轮次写入同一套日志文件,本命令按模式、轮次、证书与时间范围过滤输出,用于排查签发、续期与部署问题。
日志文件为 ~/.certiman/logs/certiman-<年月>.log,按月分卷;单卷超过 10 MB 时压缩归档,仅保留当月与上一月的日志。
用法
bash
certiman logs [flags]参数
| flag | 类型 | 默认 | 说明 |
|---|---|---|---|
--mode | string | 按模式过滤:cron(定时轮次)/ cc(CertCloud 命令)/ acme(ACME 命令) | |
--round | string | 按定时扫描轮次 ID 过滤;指定本项且未显式指定 --tail 时,输出该轮次的全部记录 | |
--cert | string | 按证书目录名过滤(主域名派生) | |
--since | string | 仅输出最近一段时间的记录,取值为时长,如 7d / 24h / 30m,可组合为 1d12h | |
--tail | int | 100 | 输出最后 N 条匹配记录;0 输出全部匹配记录 |
--follow | bool | false | 持续输出新增的匹配记录,按 Ctrl-C 结束 |
各过滤条件同时生效(逻辑与)。未指定 --follow 时读取当月日志并一次性输出。
示例
bash
# 查看当月最后 100 条日志
certiman logs
# 查看单张证书的完整日志
certiman logs --cert example.com --tail 0
# 查看最近一次定时轮次的 ACME 续期记录
certiman logs --mode acme --since 24h
# 按轮次 ID 还原一轮定时扫描的完整过程(轮次 ID 见 cron status)
certiman logs --round 20261030T080000Z
# 持续跟踪新日志(等价于 tail -f)
certiman logs --cert example.com --follow输出
日志按原始行输出,每行包含时间、级别、事件与上下文字段:
text
2026-10-30T08:00:00.000Z INFO certificate finished mode=acme command=issue cert=example.com outcome=advanced elapsed=3.2s
2026-10-30T08:00:01.000Z INFO renewal decision mode=cc command=cron round=20261030T080000Z cert=shop.example.com due=false reason=ratio-pending常用字段:
| 字段 | 含义 |
|---|---|
mode | 模式:cron / cc / acme |
command | 产生该记录的命令 |
round | 定时扫描轮次 ID,仅定时轮次包含该字段 |
cert | 证书目录名;含空格时以引号包裹 |
outcome | 处理结果,如 advanced / idle / failed |
相关命令
doctor—— 诊断安装环境cron status—— 查看定时轮次 ID 与执行结果acme status—— 查看 ACME 证书状态
