finds.dev← search

// the find

martin-helmich/prometheus-nginxlog-exporter

★ 1,078 · Go · Apache-2.0 · updated Aug 2024

Export metrics from Nginx access log files to Prometheus

A Go daemon that tails nginx (or similar) access logs and exposes Prometheus metrics for request counts, sizes, and response times. Aimed at ops teams who want per-vhost HTTP metrics without baking instrumentation into the app itself.

Supports both file tailing and syslog ingestion, so it works as a k8s sidecar reading from the same network namespace as the main container, not just flat log files. Dynamic relabeling can split a raw request path on a separator and regex-match it down to something like /users/:id, which is the actual hard part of turning access logs into usable low-cardinality metrics. Packaging is unusually thorough for a project this size: Docker images, signed deb/rpm releases with systemd units since 1.5.1, and a documented Consul service-registration block.

No commits since August 2024, so it predates recent Go toolchain and nginx log format churn, and the open issue backlog likely isn't getting attention. The default metric naming bakes the configured namespace into the metric name itself, which the README admits is a 'historic' wart you have to work around with namespace_label and metrics_override just to get normal Prometheus labels. File globs for the files source are resolved once at startup only, so a new vhost log file matching an existing glob needs a process restart to be picked up. Cardinality protection on relabeled fields is opt-in via a manual whitelist per label, so it's easy to accidentally explode a label like request_uri if you forget to constrain it.

View on GitHub →

// want more like this?

We dig through GitHub every week and send a few repos picked for what you actually care about — each with an honest take like this one.

Get finds in your inbox → Search again →