mongodb-log

MongoDB Log & Metric Analyzer

简体中文 English

A local, offline MongoDB analysis tool for operations engineers. It provides separate MongoDB Log and MongoDB Metric workspaces for inspecting logs, FTDC metrics, and runtime anomalies without connecting to MongoDB or automatically uploading data.

This project was designed, implemented, tested, and documented entirely with AI. Future changes or extensions are best made with AI while following the project rules and existing validation workflow. Although the project is AI-authored, its core analysis logic, statistical definitions, and outputs have been verified through automated tests, real-world samples, and human review.

See the English User Guide for complete operating instructions. The running application also provides a Chinese help dialog through 使用说明 in the upper-right corner.

The current web interface and exported Markdown reports are in Simplified Chinese. The English guide includes the relevant Chinese labels.

Core Capabilities

MongoDB Log

MongoDB Metric

Local-First Behavior

Quick Start

The public image is available on Docker Hub for both linux/amd64 and linux/arm64. Java, Node.js, and MongoDB are not required on the host:

docker pull whaleal/mongodb-log-analyzer:0.1.0

docker run -d \
  --name mongodb-log-analyzer \
  --restart unless-stopped \
  --memory=3g \
  -p 127.0.0.1:18080:18080 \
  -v mongodb-log-analyzer-data:/app/data \
  whaleal/mongodb-log-analyzer:0.1.0

Open http://127.0.0.1:18080 after the container starts. The container runs as a non-root user, caps the JVM heap at 2 GB, and persists task data in the mongodb-log-analyzer-data named volume. The application has no accounts or authorization, so the example publishes the port to the local machine only; do not expose it directly to the public Internet. Keep the named volume when upgrading or recreating the container, and avoid commands such as docker compose down -v that would delete it.

The latest tag is also available, but pinned deployments should use the explicit 0.1.0 version.

Run the JAR

Java 17 or newer is required. A release directory must contain the executable JAR and launcher scripts:

mongodb-log-analyzer/
├── mongodb-log-analyzer.jar
└── scripts/
    ├── start.command
    ├── start.sh
    └── start.bat

The launchers use -Xms128m -Xmx2g and normally open http://127.0.0.1:18080. Open the address manually if no browser appears. Close the launcher window or press Ctrl+C to stop the application.

Processing Model

Vue page in the browser
        | REST API
        v
Local Spring Boot service
        +-- Log: upload copy -> streaming parser -> bounded aggregation -> JSON/JSONL
        +-- Metric: upload copy -> FTDC scan -> blocks.idx -> streamed group query

Temporary Log upload copies stay under data/work only during analysis and are removed after completion or failure. Metric tasks retain uploaded copies, the metric catalog, and the block index for later queries, but do not persist a fully expanded time-series copy.

If the application restarts, tasks that were queued or running are marked as failed instead of continuing from incomplete state.

Data Layout

data/
├── tasks-index.json
├── tasks/<task-id>/
│   ├── metadata.json
│   ├── summary.json
│   ├── diagnostics.json
│   └── top-slow-queries.jsonl
├── work/<task-id>/
└── ftdc/
    ├── tasks-index.json
    ├── tasks/<task-id>/
    │   ├── metadata.json
    │   ├── catalog.json
    │   ├── blocks.idx
    │   └── source/<uploaded-file>
    └── work/<task-id>/

Deleting a task removes only application-managed data, never the user’s original files. Queued or running tasks cannot be deleted. The memory indicator exposes a clear-all action; if any task is active, the operation is rejected before any task data is removed.

Reports and Privacy Boundary

导出 AI 分析报告 generates a Markdown report for the selected Log task. It includes aggregates, normalized query patterns, retained Top results, and sanitized diagnostics, but excludes full commands, complete raw logs, and complete attributes.

The export masks MongoDB URIs, IPv4 and IPv6 addresses, email addresses, and values labeled with user, username, principal, password, passwd, token, or secret. Task names, file names, namespaces, normalized query patterns, plans, and other aggregates may still appear. Review the exported file against your organization’s data-security requirements before sharing it.

Important Limits

Implementation

Main source layout:

src/main/java/com/whaleal/mongodblog/
├── parser/      # Streaming Log and FTDC parsing
├── analysis/    # Aggregation, diagnostics, and Metric series
├── report/      # Sanitized Markdown reports
├── task/        # Task lifecycle and serialized execution
├── storage/     # Local persistence and binary indexes
└── web/         # REST API
web/src/         # Vue application
web/tests/       # Frontend tests
docs/            # Design, AI rewrite, and user guides
scripts/         # Platform launchers

REST API Overview

Scope Main endpoint Purpose
Log tasks /api/tasks Create, list, and inspect tasks
Log summary /api/tasks/{id}/summary Read aggregate results
Diagnostics /api/tasks/{id}/diagnostics Read separate runtime diagnostics
Slow queries /api/tasks/{id}/slow-queries Filter retained records with pagination
Report /api/tasks/{id}/report.md Download a sanitized Markdown report
Metric tasks /api/ftdc-tasks Create, list, and inspect FTDC tasks
Metric groups /api/ftdc-tasks/{id}/groups List queryable metric groups
Metric series /api/ftdc-tasks/{id}/groups/{groupId}/series Query one metric group
Memory /api/system/memory Read JVM heap usage
Data cleanup /api/system/data Delete all terminal tasks

These endpoints are designed for the local single-user interface. They do not provide accounts, authorization, tenant isolation, or public deployment support.

Build from Source

Java 17, Maven, Node.js, and npm are required:

mvn test
cd web
npm test -- --run
npm run build
cd ..
mvn clean package

mvn clean package removes historical build output, installs locked frontend dependencies, builds the Vue application, and generates target/mongodb-log-analyzer.jar. The repository launchers can run that file directly.

You can also build a local image from the repository root. The multi-stage Dockerfile runs the frontend and backend tests, while the final image excludes Maven, Node.js, and frontend build dependencies:

docker build -t mongodb-log-analyzer:local .

Documentation

License

Licensed under the Apache License 2.0.