https://github.com/tom-draper/nginx-analytics
A flexible & privacy-focused analytics solution for NGINX.
https://github.com/tom-draper/nginx-analytics
access access-logs accesslog analytics analytics-for-nginx analyze analyzer api errors log-analytics log-analyzer logs nginx nginx-analytics nginx-proxy nginx-server nginx-usage server-analytics server-logs
Last synced: about 1 month ago
JSON representation
A flexible & privacy-focused analytics solution for NGINX.
- Host: GitHub
- URL: https://github.com/tom-draper/nginx-analytics
- Owner: tom-draper
- License: mit
- Created: 2025-03-03T10:19:29.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2026-04-23T20:55:27.000Z (about 1 month ago)
- Last Synced: 2026-04-23T22:22:22.122Z (about 1 month ago)
- Topics: access, access-logs, accesslog, analytics, analytics-for-nginx, analyze, analyzer, api, errors, log-analytics, log-analyzer, logs, nginx, nginx-analytics, nginx-proxy, nginx-server, nginx-usage, server-analytics, server-logs
- Language: TypeScript
- Homepage: https://nginx.apianalytics.dev
- Size: 10.2 MB
- Stars: 20
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# NGINX Analytics
Transform your existing NGINX logs into an interactive real-time analytics dashboard.

## Getting Started
### Dashboard
Deploy a single Next.js dashboard to the same server as NGINX.
Follow the dashboard deployment guide.
Alternatively, drag-and-drop your `access.log` and `error.log` directly into the dashboard. Get started straight away on our deployment.
#### TUI
For those that prefer to work in the terminal, a TUI dashboard is available as an alternative.

Deploy the TUI dashboard to the server running NGINX. Access via SSH.
Follow the TUI dashboard deployment guide.
### Remote Setup
If you don’t want to run the dashboard on the same server as NGINX, deploy the agent to stream logs securely.
### Configuration
#### Locations
Geolocation by IP address can be set up easily, utilising MaxMind's free GeoLite2 database. Simply drop the `GeoLite2-City.mmdb` (preferred) or `GeoLite2-Country.mmdb` file in the root folder of the agent or dashboard deployment on your server.
#### System Monitoring
Monitoring of system resources (CPU, memory, and storage) is supported but disabled by default. Enable it by setting `NGINX_ANALYTICS_SYSTEM_MONITORING=true` in the environment variables of the agent or dashboard deployment on your server.
#### Authentication
When using the agent, it's recommended to set an authentication token. Set the private environment variable `NGINX_ANALYTICS_AUTH_TOKEN` to the same value for both the agent (server) and the dashboard (client) deployment.
The agent will verify that the auth token sent by the client matches the locally stored value before allowing access to the logs.
#### Password Protection
If your dashboard is publically accessible, set up password protection by assigning a value to the `NGINX_ANALYTICS_PASSWORD` environment variable for the dashboard deployment.
#### HTTPS
Deploying with HTTPS is always recommended. Without this, you risk exposing any personal information within your log files such as IP addresses.
#### NGINX
By default, the standard NGINX combined log format is supported. If you use a custom log format, set `NGINX_ANALYTICS_LOG_FORMAT` to match the `log_format` directive in your NGINX config.
```env
NGINX_ANALYTICS_LOG_FORMAT='$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent"'
```
To better configure NGINX to get the most out of your analytics, take a look at the NGINX configuration guide.
## Contributions
Contributions, issues and feature requests are welcome.
- Fork it (https://github.com/tom-draper/nginx-analytics)
- Create your feature branch (`git checkout -b my-new-feature`)
- Commit your changes (`git commit -am 'Add some feature'`)
- Push to the branch (`git push origin my-new-feature`)
- Create a new Pull Request
> **Disclaimer**
>
> This project is not affiliated with, sponsored by, or endorsed by F5, Inc. or the official NGINX project.
> NGINX is a registered trademark of F5, Inc. This is an independent project created by Tom Draper.
If you find value in my work, consider supporting me.
Buy Me a Coffee: https://www.buymeacoffee.com/tomdraper
PayPal: https://www.paypal.com/paypalme/tomdraper