martin-helmich / prometheus-nginxlog-exporter

Export metrics from Nginx access log files to Prometheus

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

not working

ohot2015 opened this issue · comments

prometheus-nginxlog-exporter | 2023-11-28T13:29:10.670Z info prometheus-nginxlog-exporter/main.go:139 starting listener for namespace nginx
prometheus-nginxlog-exporter | 2023-11-28T13:29:10.670Z info prometheus-nginxlog-exporter/main.go:148 running HTTP server on address 0.0.0.0:4040, serving metrics at /metrics
prometheus-nginxlog-exporter | 2023-11-28T13:29:10.670Z info tail@v1.4.8/tail.go:212 Waiting for prometheus-nginxlog-exporter -config-file /etc/prometheus-nginxlog-exporter.yml to appear...

`listen:
port: 4040
metrics_endpoint: "/metrics"

consul:
enable: false

namespaces:

  • name: nginx
    format: "$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$request_time""
    source:
    files:
    - /var/log/nginx/access.log
    syslog:
    listen_address: udp://127.0.0.1:8514" (1)
    format: "rfc3164" (2)
    tags: ["nginx"] (3)

    only_count: true
    relabel_configs:

    • target_label: request_uri
      from: request
      split: 2
      separator: ' '
      `
      log format

127.0.0.1 - - [28/Nov/2023:16:32:25 +0300] "GET /favicon.ico HTTP/1.1" 404 197 "http://test.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "0.000" 127.0.0.1 - - [28/Nov/2023:16:32:25 +0300] "GET / HTTP/1.1" 404 197 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "0.000" 127.0.0.1 - - [28/Nov/2023:16:32:25 +0300] "GET /favicon.ico HTTP/1.1" 404 197 "http://test.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "0.000" 127.0.0.1 - - [28/Nov/2023:16:32:25 +0300] "GET / HTTP/1.1" 404 197 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "0.000" 127.0.0.1 - - [28/Nov/2023:16:32:25 +0300] "GET /favicon.ico HTTP/1.1" 404 197 "http://test.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "0.000" 127.0.0.1 - - [28/Nov/2023:16:32:25 +0300] "GET / HTTP/1.1" 404 197 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "0.000" 127.0.0.1 - - [28/Nov/2023:16:32:25 +0300] "GET /favicon.ico HTTP/1.1" 404 197 "http://test.local/" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/119.0.0.0 Safari/537.36" "0.000"
docker-compose

nginx-exporter: image: quay.io/martinhelmich/prometheus-nginxlog-exporter container_name: prometheus-nginxlog-exporter command: - prometheus-nginxlog-exporter -config-file /etc/prometheus-nginxlog-exporter.yml restart: always volumes: - /var/log/nginx:/var/log/nginx - ./nginx-exporter/config.yml:/etc/prometheus-nginxlog-exporter.yml ports: - 4040:4040
localhost:4040
`# HELP nginx_parse_errors_total Total number of log file lines that could not be parsed

TYPE nginx_parse_errors_total counter

nginx_parse_errors_total 0

HELP prometheus_nginxlog_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which prometheus_nginxlog_exporter was built, and the goos and goarch for the build.

TYPE prometheus_nginxlog_exporter_build_info gauge

prometheus_nginxlog_exporter_build_info{branch="v1.11.0",goarch="amd64",goos="linux",goversion="go1.18.10",revision="76552e7cadc1f76b4e28b5c872412db4a091aca0",tags="unknown",version="1.11.0"`
image