Skip to content
nertworkPublic

About

Nxtflow — Multi-protocol NetFlow v5/v9, IPFIX & sFlow v5 Kubernetes observability platform with Loki, Prometheus, Grafana, Helm chart, CLI & AI MCP server

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Repository files navigation

nxtflow logo

nxtflow — AI-Ready Multi-Site NetFlow, IPFIX & sFlow Telemetry

CI Release Documentation GHCR Containers Helm OCI Chart CodeRabbit Reviews Contributors License: MIT

nxtflow is an open-source NetFlow v5/v9, IPFIX, and sFlow observability and AI-analysis platform for Docker Compose and Kubernetes. It pairs upstream netsampler/goflow2 with a lightweight Python enricher (nxtflow-enricher), pluggable storage backends (VictoriaLogs default, Grafana Loki, or ClickHouse), an interactive Web UI (nxtflow-ui), a multi-panel Grafana dashboard with click-to-drill-down Host & Flow Deep-Dive, a terminal CLI (nxtflow), and a read-only FastMCP server (nxtflow-mcp) so both engineers and AI coding assistants can query network traffic history in seconds.

Dashboard Preview

Interactive Web UI (nxtflow-ui)

  • Dynamic Host Exclusion (?exclude=<host>): Click any ⊘ Hide button on a host or talker row to filter noisy hosts out of Overview KPIs, Sankey diagrams, and Flow Explorer, with an Exclude chip bar to restore individual hosts or clear all.
  • Light / Dark Theme Toggle (☀️ / 🌙) & Version Badge: Switch between dark and light themes from the top bar (persisted in localStorage), with the active release version badge (e.g., v0.2.4, matching nxtflow --version) displayed in the header.

nxtflow-ui Overview Dashboard (Dark Mode)

nxtflow-ui Host Deep-Dive Drawer with 3-Tier Host Sankey and 5-Tuple Sessions

View nxtflow-ui Light Mode screenshot

nxtflow-ui Overview Dashboard (Light Mode)

Grafana Dashboard

nxtflow Grafana Overview Dashboard

nxtflow Grafana Flow Analytics & Top Talkers

View full-page 18-panel Grafana dashboard screenshot

nxtflow Full-Page Grafana Dashboard


Architecture

flowchart LR
  Exporters["Routers & Switches<br/>NetFlow v5/v9 · IPFIX · sFlow<br/>UDP :2055 / :6343"] --> GoFlow2["netsampler/goflow2 v2.2.7<br/>-transport=file (raw.jsonl)"]
  GoFlow2 --> Enricher["nxtflow-enricher<br/>Direction · Sampling · rDNS · NetBox<br/>:8081 HTTP/Health · :9090 Metrics"]
  Enricher -->|Direct gzip push or Alloy sidecar| Store["Storage Backend<br/>VictoriaLogs (default) · Loki · ClickHouse"]
  Enricher --> Prom["Prometheus<br/>ServiceMonitor & PrometheusRule"]
  Store --> UI["nxtflow-ui<br/>Interactive Web Explorer & Host Drawer"]
  Store --> Grafana["Grafana Dashboard<br/>Sankey · dataLinks · Host & Flow Deep-Dive"]
  Store --> CLI["nxtflow CLI"]
  Store --> MCP["nxtflow-mcp<br/>10 read-only FastMCP tools"]
Loading

Storage Backends (VictoriaLogs vs. Loki vs. ClickHouse)

nxtflow defaults to VictoriaLogs (NXTFLOW_BACKEND=victorialogs) for high-cardinality speed, zero series caps, and a tiny single-binary footprint, while natively supporting Grafana Loki and ClickHouse across nxtflow-enricher, nxtflow CLI, nxtflow-mcp, nxtflow-ui, Docker Compose, and the Helm chart:

Real-World Performance & Footprint Comparison

Metric VictoriaLogs (Default) Grafana Loki ClickHouse
Interactive Queries (5m–24h) 76ms–185ms 300ms–2s+ 10ms–60ms
Long-Range Queries (7d–30d) 150ms–1.5s 5s–30s+ 10ms–80ms (30d+ OLAP)
Memory Footprint (RAM) ~200–350 MiB 1–2 GiB 1–4 GiB
Architecture Single binary Multi-component (or SingleBinary TSDB) Columnar MergeTree server
Cardinality / Series Cap Zero 5,000-series cap (native per-IP/port indexing) 5,000-series cap (max_query_series: 5000) Zero series cap (columnar MergeTree)
Query Language LogsQL (_time:... | stats ...) LogQL ({job, site, dir}) SQL (MergeTree nxtflow.flows)
Default Port / Image :9428 (victoriametrics/victoria-logs:v1.24.0-victorialogs) :3100 (grafana/loki:3.7.11) :8123 (clickhouse/clickhouse-server:26.8-alpine)
Grafana Datasource victoriametrics-logs-datasource Built-in loki grafana-clickhouse-datasource
Docker Compose Start ./scripts/up.sh ./scripts/up.sh --backend loki ./scripts/up.sh --backend clickhouse
Helm Values Example examples/values-standalone.yaml examples/values-loki.yaml examples/values-clickhouse.yaml
Best For Default for single-host, K8s & high-cardinality flows Existing Grafana/Loki stacks 30d+ OLAP & multi-terabyte SQL analytics

Key Capabilities

  • Dual-Mode Helm Chart (charts/nxtflow):
    • Standalone (tags.standalone=true): Batteries-included install deploying VictoriaLogs (StatefulSet, default) — or optional Loki / ClickHouse — alongside minimal prometheus, grafana (auto-provisioned datasources + 18-panel dashboard), goflow2 + nxtflow-enricher, and nxtflow-mcp.
    • Integrated (tags.standalone=false): Plugs into your existing VictoriaLogs, Loki, or ClickHouse, kube-prometheus-stack (ServiceMonitor + PrometheusRule), and Grafana sidecar (grafana_dashboard: "1").
    • Collector-Only (examples/values-collector-only.yaml): Lightweight edge collector shipping flows from remote sites into a central VictoriaLogs, Loki, or ClickHouse instance.
  • 5000-Series-Safe Loki Schema: Writes only 3 bounded stream labels per site ({job, site, dir}) and protects port aggregations with dst_port =~ '.{1,4}' | __error__=''.
  • 5-Tuple Pre-NAT Reverse-Correlation (enricher.classification.natCorrelation): Automatically correlates pre-NAT inbound router WAN flows (external-cdn -> wan-gateway) back to the originating internal host (external-cdn -> (via wan-gateway) -> internal-host) using a bounded TTL 5-tuple lookup table (ttlSeconds: 600, maxEntries: 100000) plus optional GoFlow2 post_nat_dst_addr fields.
  • Interactive Web UI (nxtflow-ui) & Grafana Drill-Down: Kentik/Netdata-style Starlette + ECharts web explorer (docker compose --profile ui up -d or Helm ui.enabled=true) featuring live direction/site/pair Flow Explorer, Host Deep-Dive drawer (observed IPs with ipinfo.io lookup, 3-tier Host Traffic Flow Sankey, and 5-tuple sessions), and Host Directory — alongside Grafana click-to-drill-down dataLinks targeting the Host & Flow Deep-Dive panel.
  • 7-Tier Host Resolution: Combines staticHosts, custom internalCidrs, wanIps, optional NetBox IPAM sync, built-in public CDN/DNS CIDRs (103 IPv4/IPv6 ranges), and a bounded LRU+TTL reverse DNS cache.
  • AI-Native Telemetry (nxtflow CLI & nxtflow-mcp): Query top talkers, top destinations, 5-tuple host sessions, ports, and flow search via terminal or any MCP client (stdio or streamable-http).

Quick Start (Docker Compose)

Run the full standalone stack (GoFlow2 + nxtflow-enricher + VictoriaLogs (default)/Loki/ClickHouse + Prometheus + Grafana + nxtflow-mcp) locally or on any Docker host in three commands:

cp .env.example .env
# Edit .env if needed (e.g. NXTFLOW_GRAFANA_PORT=3030 if port 3000 is already in use)
./scripts/up.sh

Or select a backend (victorialogs default, loki, or clickhouse) with the synthetic NetFlow v9 traffic generator (--demo) and verify end-to-end:

./scripts/up.sh --demo                              # VictoriaLogs (default)
./scripts/up.sh --backend loki --demo               # Grafana Loki
./scripts/up.sh --backend clickhouse --demo         # ClickHouse

./scripts/verify-stack.sh                           # or: --backend loki | clickhouse

Once running:

  • Grafana Dashboard: http://localhost:${NXTFLOW_GRAFANA_PORT:-3000}/d/nxtflow-overview (default login: admin / nxtflow)
  • Interactive Web UI (nxtflow-ui, optional --profile ui): http://localhost:${NXTFLOW_UI_PORT:-8082} (docker compose --profile ui up -d nxtflow-ui)
  • Backend API: VictoriaLogs http://localhost:${NXTFLOW_VICTORIALOGS_PORT:-9428} (default) · Loki http://localhost:${NXTFLOW_LOKI_PORT:-3100} · ClickHouse http://localhost:${NXTFLOW_CLICKHOUSE_PORT:-8123}
  • Prometheus UI: http://localhost:${NXTFLOW_PROMETHEUS_PORT:-9091}
  • MCP Endpoint: http://localhost:${NXTFLOW_MCP_PORT:-8000}/mcp
  • Send a one-shot test burst: python3 scripts/demo-flows.py --once
  • Query via containerized CLI (no local Python install required): docker compose exec nxtflow-mcp nxtflow summary --range 15m

Customize docker/enricher/enricher.yaml to add wanIps, staticHosts, or internalCidrs, and docker compose up -d --force-recreate enricher to apply.

-> Full Docker Compose Guide: docs/docker-compose.md · nertwork.github.io/nxtflow/docker-compose.html


Quick Start (Helm)

1. Standalone (All-in-One, VictoriaLogs Default)

Deploys the collector, enricher, VictoriaLogs, Prometheus, Grafana, and MCP server in one release:

helm install nxtflow oci://ghcr.io/nertwork/charts/nxtflow \
  --namespace nxtflow --create-namespace \
  -f examples/values-standalone.yaml

Forward Grafana locally and open http://localhost:3000/d/nxtflow-overview:

kubectl port-forward -n nxtflow svc/nxtflow-grafana 3000:80

2. Integrated (Existing VictoriaLogs, Loki, or ClickHouse + Prometheus & Grafana)

Connects to an existing VictoriaLogs (default), Loki, or ClickHouse endpoint and provisions ServiceMonitor, PrometheusRule, and the Grafana dashboard ConfigMap:

helm install nxtflow oci://ghcr.io/nertwork/charts/nxtflow \
  --namespace monitoring \
  -f examples/values-integrated.yaml \
  --set externalVictoriaLogs.url="https://victorialogs.example.com"

3. Collector-Only (Remote Edge Site)

Deploys only the UDP collector and enricher for a remote branch site:

helm install nxtflow-edge oci://ghcr.io/nertwork/charts/nxtflow \
  --namespace nxtflow \
  -f examples/values-collector-only.yaml \
  --set collector.site="branch-west" \
  --set externalVictoriaLogs.url="https://victorialogs.example.com"

Note on externalTrafficPolicy: Local: Keep collector.service.externalTrafficPolicy=Local on LoadBalancer/NodePort services so Kubernetes preserves the true source IP of your exporting routers instead of SNATing it.


Customizing Site & Exporter Labels

Every enriched flow record is tagged with bounded Loki stream labels {job, site, dir} so you can aggregate and filter multi-site traffic without cardinality explosion:

  1. Site Label (collector.site): Set a unique collector.site (for example "us-east", "branch-west", or "lab") on each Helm release. New sites automatically appear in the Grafana Site dropdown and nxtflow status.
  2. Direction Classification & Pre-NAT Correlation (enricher.classification): Configure localCidrs (your internal subnets) and wanIps (your router public/WAN IPs for that site) so traffic is accurately tagged as up, down, or lan, and keep natCorrelation.enabled=true so pre-NAT inbound WAN downloads resolve back to the internal LAN host.
  3. Host & Service Aliases (enricher.resolution): Map key IPs in staticHosts (such as "192.168.1.1": "core-router"), name internal subnets in internalCidrs, or enable enricher.netbox.enabled=true to sync IPAM hostnames automatically.

Configuration & Environment Variables

The nxtflow CLI and nxtflow-mcp resolve settings in order: built-in defaults -> ~/.config/nxtflow/config.yaml (or --config / NXTFLOW_CONFIG_FILE) -> environment variables:

Environment Variable Default Description
NXTFLOW_BACKEND victorialogs Active storage backend (victorialogs, loki, or clickhouse)
NXTFLOW_LOKI_URL http://localhost:3100 Base URL for the target Loki API
NXTFLOW_VICTORIALOGS_URL http://localhost:9428 Base URL for VictoriaLogs (/insert/jsonline, /select/logsql/*)
NXTFLOW_VICTORIALOGS_ACCOUNT_ID / NXTFLOW_VICTORIALOGS_PROJECT_ID "" Optional VictoriaLogs multitenancy headers (AccountID, ProjectID)
NXTFLOW_CLICKHOUSE_URL http://localhost:8123 Base HTTP URL for ClickHouse
NXTFLOW_CLICKHOUSE_DATABASE / NXTFLOW_CLICKHOUSE_TABLE nxtflow / flows ClickHouse database and MergeTree table name
NXTFLOW_CLICKHOUSE_USER / NXTFLOW_CLICKHOUSE_PASSWORD default / "" ClickHouse credentials (nxtflow in local Docker Compose)
NXTFLOW_JOB nxtflow job label to query (collector.job)
NXTFLOW_TLS_VERIFY true true, false, or path to a custom CA bundle
NXTFLOW_LOKI_TOKEN "" Optional Bearer token for authenticated Loki
NXTFLOW_LOKI_USER / NXTFLOW_LOKI_PASSWORD "" Optional Basic auth credentials for Loki
NXTFLOW_LOKI_TENANT_ID "" Optional X-Scope-OrgID multi-tenant header
NXTFLOW_EXCLUDED_HOSTS multicast,link-local Comma-separated hostnames excluded from top-N views

See CLI, MCP Server & AI Skill Integration and charts/nxtflow/values.yaml for the complete reference.


CLI & MCP Quick Start

Install the Python package locally (with MCP server support):

pip install "nxtflow[mcp] @ git+https://github.com/nertwork/nxtflow.git"
# or with uv:
uv tool install --from "git+https://github.com/nertwork/nxtflow.git" "nxtflow[mcp]"

Query VictoriaLogs (default) from your terminal:

export NXTFLOW_VICTORIALOGS_URL="http://localhost:9428"
nxtflow --version
nxtflow status
nxtflow summary --range 1h
nxtflow top-talkers 10 --range 15m
nxtflow host 192.168.1.10 --range 1h
nxtflow sessions 192.168.1.10

Run nxtflow-mcp over stdio (see mcp/nxtflow.mcp.json and skills/nxtflow/SKILL.md):

nxtflow-mcp --transport stdio

Exporter Configuration Guides

Ready-to-use templates live in examples/exporters/:


Testing & Verification

Run the local audit, linter, Helm checks, and unit test suite before opening a pull request:

docker compose --env-file .env.example config -q
python3 scripts/security_audit.py
ruff check src tests scripts .github/scripts
helm lint charts/nxtflow
pytest -v

Security & CI/CD Quality

Every push and pull request runs automated GitHub Actions verification:

  • Lint, Syntax & Security Audit: scripts/security_audit.py scans repository files for exposed API tokens, private keys, webhook URLs, and Python/JSON syntax issues.
  • Python Lint & Unit Tests: ruff static checks and pytest coverage across CLI, enricher, and MCP tools.
  • Helm Lint, Schema & Template: helm lint, JSON Schema validation (values.schema.json), ct lint, and multi-mode template rendering tests.
  • Docker Build & Kind Helm Install: Builds container images and executes an end-to-end helm install + helm test inside an ephemeral Kind cluster.
  • CodeQL, Dependabot & Supply-Chain Security: Continuous GitHub CodeQL static analysis (codeql.yml for Python and GitHub Actions), Dependabot vulnerability & malware alerts, Secret Scanning + Push Protection, and Private Vulnerability Reporting.

See SECURITY.md for architecture details and private vulnerability reporting.


Documentation

Full hosted documentation is automatically published to https://nertwork.github.io/nxtflow/:

Community & Contributors

Thank you to everyone contributing code, exporter guides, bug reports, and platform improvements to nxtflow!

  • @nertwork (James Farr Gomez) — Creator & Maintainer (Helm chart architecture, nxtflow-enricher, multi-backend flow pipeline (VictoriaLogs, Loki, ClickHouse), 18-panel Grafana dashboard, nxtflow CLI & FastMCP server).

See the full GitHub Contributors Graph and our Contributing Guide to get involved.

Contributing & License

Contributions are welcome! Please review CONTRIBUTING.md before submitting a pull request. Released under the MIT License.

About

Nxtflow — Multi-protocol NetFlow v5/v9, IPFIX & sFlow v5 Kubernetes observability platform with Loki, Prometheus, Grafana, Helm chart, CLI & AI MCP server

Topics

Resources

Code of conduct

Contributing

Security policy

Stars

3 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages