使用 Prometheus 收集 caddy2 日志

在全局开启 metrics 是必要的, 否则取不到数据

{
        servers {
                protocols h3 h2c h2 h1
                metrics
        }
        log {
                output file /var/log/caddy/access.log
                format json
                level DEBUG
        }
}
# 安装 prometheus
sudo apt install prometheus

# 配置文件中添加 caddy
sudo vim /etc/prometheus/prometheus.yml

# 然后重启 prometheus
sudo systemctl restart prometheus

/etc/prometheus/prometheus.yml

scrape_configs:
  - job_name: caddy
    static_configs:
      - targets: ['localhost:2019']

--- satori ---

Last