1
0
Fork 0
mirror of https://github.com/demostf/setup synced 2026-06-04 00:54:07 +02:00

nginx metrics

This commit is contained in:
Robin Appelman 2024-01-14 02:17:22 +01:00
commit da8ed6a0e2
3 changed files with 47 additions and 2 deletions

View file

@ -109,10 +109,18 @@ services:
- LOKI_PASSWORD=${LOKI_PASSWORD}
command: -config.file=/etc/promtail/promtail.yml -config.expand-env=true
metrics:
image: ghcr.io/martin-helmich/prometheus-nginxlog-exporter/exporter:v1
networks:
- proxy-tier
volumes:
- logs:/logs:ro
- ./nginxlog.yaml:/nginxlog.yaml
command: -config-file=/nginxlog.yaml
networks:
proxy-tier:
db-tier:
parser-tier:
volumes:
logs:

37
nginxlog.yaml Normal file
View file

@ -0,0 +1,37 @@
{
"listen": {
"address": "0.0.0.0",
"metrics_endpoint": "/metrics",
"port": 80
},
"namespaces": [
{
"format": "$remote_addr $host - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" rt=$request_time uct=\"$upstream_connect_time\" uht=\"$upstream_header_time\" urt=\"$upstream_response_time\"",
"histogram_buckets": [
0.005,
0.01,
0.025,
0.05,
0.1,
0.25,
0.5,
1,
2.5,
5,
10
],
"name": "nginx",
"relabel_configs": [
{
"from": "host",
"target_label": "host"
}
],
"source": {
"files": [
"/logs/nginxlog.log"
]
}
}
]
}

View file

@ -19,4 +19,4 @@ scrape_configs:
labels:
job: varlogs
host: demos.tf
__path__: /logs/*log
__path__: /logs/access.log