martin-helmich / prometheus-nginxlog-exporter

Export metrics from Nginx access log files to Prometheus
Apache License 2.0
958 stars 173 forks source link

example json pasrsing #385

Closed okeymynameismax closed 8 months ago

okeymynameismax commented 8 months ago

While working, I came across the issue that there is no approximate configuration for json parsing. Maybe someone will find it useful, I'll leave it here. Because I myself spent a couple of days figuring out how to set the parameters correctly.

listen { port = 9090 }

namespace "nginx" { parser = "json" source = { files = [ "/var/log/nginx/*.log" ] }

}

okeymynameismax commented 8 months ago