标签:index har 离线 sts sock 方案 准备 方便 技术
goaccess 是一个不错的日志分析工具,包含了json 数据同时支持基于websocket 的实时数据处理,当然我们可以通过jsonpath
的exporter 转换为支持promethues 的metrics,还是很方便的
version: "3"
services:
metrics:
image: sunbird/prometheus-jsonpath-exporter
volumes:
- "./conf/config.yml:/etc/prometheus-jsonpath-exporter/config.yml"
ports:
- "9158:9158"
command: /etc/prometheus-jsonpath-exporter/config.yml
g:
image: grafana/grafana
ports:
- "3000:3000"
p:
image: prom/prometheus
volumes:
- "./conf/prometheus.yml:/etc/prometheus/prometheus.yml"
ports:
- "9090:9090"
log:
image: dalongrong/goaccess-geo
ports:
- "7890:7890"
volumes:
- "./data:/srv/data"
- "./logs:/srv/logs"
- "./html:/srv/report"
- "./geoip/:/src/geoip/"
web:
image: nginx
ports:
- "8080:80"
volumes:
- "./html/:/usr/share/nginx/html/"
conf/prometheus.yml
scrape_configs:
- job_name: go_access
metrics_path: /
static_configs:
- targets: [‘metrics:9158‘]
conf/config.yml
exporter_port: 9158 # Port on which prometheus can call this exporter to get metrics
log_level: info
json_data_url: http://web/app.json # Url to get json data used for fetching metric values
metric_name_prefix: go_access # All metric names will be prefixed with this value
metrics:
- name: total_request # Final metric name will be go_access_total_request
description: Number of total request
path: $.general.total_requests
主要是添加支持json 的处理data/goaccess.conf
geoip-database /src/geoip/GeoLiteCity.dat
log-format COMBINED
real-time-html true
log-file /srv/logs/access.log
output /srv/report/index.html
output /srv/report/app.json
docker-compose up -d
这个只是一种简单的处理实际上我们可以基于其他的nginx 或者logger exporter 进行prometheus metrics 的处理,对于需要进行离线日志请求分析的,
也是一种不错的方案,需要的操作比较少,但是可以帮助我们分析好多有用的信息
https://github.com/project-sunbird/prometheus-jsonpath-exporter
https://github.com/rongfengliang/goaccess-geoip-docker-compose-demo
https://goaccess.io/
https://goessner.net/articles/JsonPath/index.html#e2
goaccess 通过jsonpath 转换为prometheus metrics
标签:index har 离线 sts sock 方案 准备 方便 技术
原文地址:https://www.cnblogs.com/rongfengliang/p/10688965.html