All Projects → blind-oracle → nginx-prometheus

blind-oracle / nginx-prometheus

Licence: MPL-2.0 license
Turn Nginx logs into Prometheus metrics

Programming Languages

go
31211 projects - #10 most used programming language
Makefile
30231 projects

Projects that are alternatives of or similar to nginx-prometheus

Flog
🎩 A fake log generator for common log formats
Stars: ✭ 531 (+1731.03%)
Mutual labels:  log, syslog
Nim Morelogging
Logging library for Nim
Stars: ✭ 29 (+0%)
Mutual labels:  log, syslog
Console
OS X console application.
Stars: ✭ 298 (+927.59%)
Mutual labels:  log, syslog
WatsonSyslogServer
C# Syslog Server
Stars: ✭ 18 (-37.93%)
Mutual labels:  log, syslog
siemstress
Very basic CLI SIEM (Security Information and Event Management system).
Stars: ✭ 24 (-17.24%)
Mutual labels:  log, syslog
Quicklogger
Library for logging on files, console, memory, email, rest, eventlog, syslog, slack, telegram, redis, logstash, elasticsearch, influxdb, graylog, Sentry, Twilio, ide debug messages and throw events for Delphi/Firemonkey/freepascal/.NET (Windows/Linux/OSX/IOS/Android).
Stars: ✭ 137 (+372.41%)
Mutual labels:  log, syslog
Raftman
A syslog server with integrated full text search via a JSON API and Web UI
Stars: ✭ 26 (-10.34%)
Mutual labels:  log, syslog
LogESP
Open Source SIEM (Security Information and Event Management system).
Stars: ✭ 162 (+458.62%)
Mutual labels:  log, syslog
Tlog
Terminal I/O logger
Stars: ✭ 170 (+486.21%)
Mutual labels:  log, syslog
Go Logger
一个简单而强大的 golang 日志工具包,支持同步和异步输出到 命令行,文件, api 接口,文件支持按文件大小,文件行数,日期切分;A simple and powerful golang logging toolkit that supports synchronous and asynchronous output to the console, file, API interfaces, file support by file size, file line number, date sharding.
Stars: ✭ 152 (+424.14%)
Mutual labels:  log, syslog
Sagan
** README ** This repo has MOVED to https://github.com/quadrantsec/sagan
Stars: ✭ 236 (+713.79%)
Mutual labels:  log, syslog
aixlog
Header-only C++ logging library
Stars: ✭ 95 (+227.59%)
Mutual labels:  log, syslog
LogCat
🐞 Android Logcat 日志工具
Stars: ✭ 51 (+75.86%)
Mutual labels:  log
Infinite-File-Curtailer
Curtail is a utility program that reads stdin and writes to a file bound by size.
Stars: ✭ 23 (-20.69%)
Mutual labels:  log
observatorium
This repository contains the deployment configurations for the Observatorium instances
Stars: ✭ 129 (+344.83%)
Mutual labels:  prometheus
ginprom
Gin Prometheus metrics exporter inspired by https://github.com/zsais/go-gin-prometheus
Stars: ✭ 97 (+234.48%)
Mutual labels:  prometheus
logt
🖥️ A colourful logger for the browser
Stars: ✭ 35 (+20.69%)
Mutual labels:  log
spdlog setup
spdlog setup initialization via file configuration for convenience.
Stars: ✭ 68 (+134.48%)
Mutual labels:  log
hcloud-pricing-exporter
A prometheus exporter for the current pricing and costs of your HCloud account
Stars: ✭ 19 (-34.48%)
Mutual labels:  prometheus
mongoose-morgan
An npm package for saving morgan log inside MongoDB
Stars: ✭ 14 (-51.72%)
Mutual labels:  log

Nginx log parser and Prometheus exporter

Go Report Card Coverage Status Build Status Mentioned in Awesome Go

This service parses incoming syslog messages from Nginx sent over UDP and converts them into Prometheus metrics exported through the built-in HTTP server.

  • If the prefix-list is specified then per-URI statistics are generated. Using this feature without URI-prefix list is dangerous because it leads to an unbounded memory usage. It's therefore enabled only with a limited prefix list.

    The URI prefix list is a plain-text file with a single prefix per line, e.g.

    /api/call1.json
    /api/call2.json
    /api/call3.json

    URIs received from nginx are stripped of any query parameters - only the part before '?' is used.

  • It optionally supports country lookup for client IPs using MaxMind GeoIP database.

Nginx configuration snippet

log_format collector '$remote_addr|$scheme|$host|$request_method|$server_protocol|$request_uri|$status|$request_time|$request_length|$bytes_sent';
access_log syslog:server=1.1.1.1:1514,tag=nginx collector;

Getting it

  • Get RPM & DEB directly from releases, only linux-amd64 build currently available.

  • Build youself:

go get github.com/blind-oracle/nginx-prometheus
cd $GOPATH/src/github.com/blind-oracle/nginx-prometheus
go build

Usage example

If you're using RPM/DEB packages then options are set in /etc/default/nginx-prometheus

./nginx-prometheus \
-debug false \
-listenSyslog 0.0.0.0:1514 \
-listenHTTP 0.0.0.0:1514 \
-geoipCountryDB /etc/nginx-prometheus/country.mmdb \
-uriPrefixFile /etc/nginx-prometheus/uriPrefixes.txt
  • debug - prints every syslog message received if true (defaults to false)
  • listenSyslog - ip:port on which to listen for UDP Syslog messages (defaults to 0.0.0.0:1514)
  • listenHTTP - ip:port on which to listen for incoming HTTP requests from Prometheus (defaults to 0.0.0.0:11080)
  • geoipCountryDB - path to MaxMind country GeoIP database (optional)
  • uriPrefixFile - path to a URI prefix list (optional)

Grafana dashboard

Add Prometheus source to Grafana and import grafana-dashboard.json for most common graphs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].