[Open Source] An open-source, lightweight Nginx log analysis tool developed in Go

Open SourceProcess Management
2026-06-28 06:34 1 次浏览 • 0 次下载 0KB
[Open Source] An open-source, lightweight Nginx log analysis tool developed in Go

1. Project Overview

NixVis

NixVis is an open-source, lightweight Nginx log analysis tool developed in Go, specifically designed for self-hosted environments. It provides intuitive data visualization and comprehensive statistical analysis to help you monitor key metrics such as website traffic, traffic sources, and geographic distribution in real time. It can be quickly deployed and used without complicated configuration.

2. Open Source License

Licensed under MIT

3. Screenshots

Image
Image
Image

4. Feature Overview

Features

  • Comprehensive Traffic Metrics
    Real-time statistics for unique visitors (UV), page views (PV), and traffic data
  • Geographic Distribution
    Visualized maps showing traffic sources across China and worldwide
  • Detailed Traffic Rankings
    Rankings for URLs, referrers, browsers, operating systems, and device types
  • Time Series Analysis
    Supports viewing traffic trends by hour and by day
  • Multi-Site Support
    Monitor traffic data from multiple websites simultaneously
  • Incremental Log Parsing
    Automatically scans Nginx log files, parses and stores the latest data
  • High-Performance Queries
    Uses lightweight SQLite for storage, combined with a multi-level caching strategy to deliver fast responses
  • Embedded Resources
    Frontend resources and IP databases are embedded in the executable, eliminating the need to deploy additional static files

5. Tech Stack

Quick Start

1. Download the latest version of NixVis
wget nixvis
chmod +x nixvis
2. Generate the Configuration File
./nixvis -gen-config
After execution, a nixvis_config.json configuration file will be generated in the current directory.
3. Edit the configuration file nixvis_config.json and add your website information and log paths
{
  "websites": [
    {
      "name": "Example Website 1",
      "logPath": "./weblog_eg/blog.beyondxin.top.log"
    },
    {
      "name": "Example Website 2",
      "logPath": "/var/log/nginx/blog.log"
    }
  ],
  "system": {
    "logDestination": "file",
    "taskInterval": "5m"
  },
  "server": {
    "Port": ":8088"
  },
  "pvFilter": {
    "statusCodeInclude": [
      200
    ],
    "excludePatterns": [
      "favicon.ico$",
      "robots.txt$",
      "sitemap.xml$",
      "\\.(?:js|css|jpg|jpeg|png|gif|svg|webp|woff|woff2|ttf|eot|ico)$",
      "^/api/",
      "^/ajax/",
      "^/health$",
      "^/_(?:nuxt|next)/",
      "rss.xml$",
      "feed.xml$",
      "atom.xml$"
    ]
  }
}

Supports log paths with automatic rotation (see Instructions for details)

4. Start the NixVis service
./nixvis
5. Access the Web interface [http://localhost:8088](http://localhost:8088)

Compile from Source Code

If you want to compile NixVis from source, follow these steps:

# Clone the project repository
git clone nixvis
cd nixvis
# Build the project
go mod tidy
go build -o nixvis ./cmd/nixvis/main.go
# Or use the build script
# bash package.sh

Docker Deployment

1. Download docker-compose
wget /docker/docker-compose.yml
wget /docker/nixvis_config.json
2. Modify nixvis_config.json to add your website information and log paths
3. Modify docker-compose.yml to add file mounts (nixvis_config.json and log files)

If you need to analyze multiple log files, consider mounting the entire log directory (e.g.,
/var/log/nginx:/var/log/nginx:ro)。

version: '3'
services:
  nixvis:
    image: ${{ secrets.DOCKERHUB_USERNAME }}/nixvis:latest
    ports:
      - "8088:8088"
    volumes:
      - ./nixvis_config.json:/app/nixvis_config.json:ro
      - /var/log/nginx/blog.log:/var/log/nginx/blog.log:ro
      - /etc/localtime:/etc/localtime:ro
4. Start
docker compose up -d
5. Access the Web interface [http://localhost:8088](http://localhost:8088)

Tech Stack

  • Backend
    :Go language (Gin framework, ip2region geographic location lookup)
  • Frontend
    :Native HTML5/CSS3/JavaScript (ECharts map visualization, Chart.js charts)
#1
资源直链https://github.com/BeyondXinXin/nixvis
去下载
星河码客

发现和分享优质开源项目,传承互联网精神,为开发者服务。

关于本站

联系我们

微信/广告合作:ITcloub (备注星河码客)

免责声明:本站资源版权归原作者所有,仅供学习与交流。如有侵权,请通过「关于我们 - 侵权投诉」联系删除。

Powered by Nuxt · Deployed on Cloudflare