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

could not be parsed into float #375

Open
df911 opened this issue Jan 16, 2024 · 1 comment
Open

could not be parsed into float #375

df911 opened this issue Jan 16, 2024 · 1 comment
Labels

Comments

@df911
Copy link

df911 commented Jan 16, 2024

Describe the bug
I get this error : "error prometheus-nginxlog-exporter/main.go:356 error while parsing $upstream_response_time: value 'rt=0' could not be parsed into float"

To Reproduce
use the configuration files below

Expected behavior
Don't have errors into logs

Configuration file (remove section, if not applicable):
nginx.conf

log_format custom '$remote_addr - $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"';

config.hcl

format = "$remote_addr - $remote_user [$time_local] \"$request\" $status $body_bytes_sent \"$http_referer\" \"$http_user_agent\" $upstream_response_time"

log file :
/home/runner/work/prometheus-nginxlog-exporter/prometheus-nginxlog-exporter/main.go:268 2024-01-16T14:30:19.486Z error prometheus-nginxlog-exporter/main.go:356 error while parsing $upstream_response_time: value 'rt=0' could not be parsed into float main.observeMetrics /home/runner/work/prometheus-nginxlog-exporter/prometheus-nginxlog-exporter/main.go:356 main.processSource /home/runner/work/prometheus-nginxlog-exporter/prometheus-nginxlog-exporter/main.go:333 main.processNamespace.func4 /home/runner/work/prometheus-nginxlog-exporter/prometheus-nginxlog-exporter/main.go:268 2024-01-16T14:30:19.486Z error prometheus-nginxlog-exporter/main.go:356 error while parsing $upstream_response_time: value 'rt=0' could not be parsed into float

Environment:

  • Exporter version: latest
  • OS (e.g. from /etc/os-release): amd64
  • Deployment method (e.g. Docker image, deb/rpm package, self-compiled, ...): Docker with last version
@df911 df911 added the bug label Jan 16, 2024
@yatesliang
Copy link

I guess that's because your log format in nginx is urt="$upstream_response_time" but the format in exporter config is $upstream_response_time
Then the exporter took urt=0 as $upstream_response_time, and urt=0 is obviously not a float

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