Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

not working #364

Open
ohot2015 opened this issue Nov 28, 2023 · 1 comment
Open

not working #364

ohot2015 opened this issue Nov 28, 2023 · 1 comment
Labels

Comments

@ohot2015
Copy link

ohot2015 commented Nov 28, 2023

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 [email protected]/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

@ohot2015 ohot2015 added the bug label Nov 28, 2023
@ecsimsw
Copy link

ecsimsw commented Mar 20, 2024

How about applying an escape char to the quotes in a yaml string format?

In my case, I did like this and it worked.

namespaces:
  - name: app1
    format: "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" \"$http_x_forwarded_for\""

Hope this helps!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants