mackerel-plugin-accesslog で 複数のアクセスログを扱う


ポイントは3つ

  • [Key]はユニークに
  • Key1つにcommandは1つだけ
  • -metric-key-prex はグラフのプレフィックスになるので分かりやすい名前でOK
[plugin.metrics.accesslog_default]
command = "mackerel-plugin-accesslog -metric-key-prefix default /var/log/nginx/default.access.log"

[plugin.metrics.accesslog_localhost]
command = "mackerel-plugin-accesslog -metric-key-prefix localhost /var/log/nginx/localhost.access.log"

[plugin.metrics.accesslog_exmaple_com]
command = "mackerel-plugin-accesslog -metric-key-prefix example.com /var/log/nginx/example.com.access.log"

[plugin.metrics.accesslog_api_exmaple_com]
command = "mackerel-plugin-accesslog -metric-key-prefix api.example.com /var/log/nginx/api.example.com.access.log"

[plugin.metrics.accesslog_img_exmaple_com]
command = "mackerel-plugin-accesslog -metric-key-prefix api.example.com /var/log/nginx/img.example.com.access.log"

お手軽ですね