No description
Find a file
2026-01-10 16:02:56 +01:00
src add tests 2026-01-10 16:02:56 +01:00
tests add tests 2026-01-10 16:02:56 +01:00
.gitignore initial commit 2025-12-22 20:56:06 +01:00
agents.md feat: add first agents.md template 2025-12-23 16:44:24 +01:00
Cargo.lock add tests 2026-01-10 16:02:56 +01:00
Cargo.toml add tests 2026-01-10 16:02:56 +01:00
README.md initial commit 2025-12-22 20:56:06 +01:00

InfluxDB Dump & Analyze Tool

A blazing fast, safe CLI tool written in Rust to inspect, analyze, and dump the schema structure of an InfluxDB v2 bucket. It helps you understand your data layout by distinguishing between Tags and Fields, detecting data types, and analyzing value ranges.

Features

  • Schema Discovery: Automatically detects Measurements, Tag Keys, and Field Keys.
  • Type Inference: Infers data types for fields (Float, Integer, String, Boolean) and detects mixed-type fields.
  • Value Analysis:
    • Tags: Lists unique values (cardinality check).
    • Fields: Calculates Min/Max for numbers and lists unique values for strings.
  • Flexible Output:
    • Text (Default): Human-readable tree view.
    • JSON: Machine-readable format for piping into other tools (like jq).
  • Secure Authentication: Supports retrieving Tokens/Passwords via shell commands (e.g., from pass, rbw, or gnome-keyring) to avoid secrets in shell history.
  • Performance: Written in Rust, using streaming analysis to handle large datasets efficiently.

Installation

From Source

Requirements: Rust & Cargo installed.

# Clone the repository
git clone <repository-url>
cd influx-dump

# Build and Install
cargo install --path .

Or just build the binary:

cargo build --release
# Binary is at ./target/release/influx-dump

Usage

Basic Structure Scan

Quickly scan the last 30 days (default limit: 100 records per measurement) to infer the schema.

influx-dump --host http://localhost:8086 \
            --org my-org \
            --bucket my-bucket \
            --token "my-secret-token"

Avoid pasting tokens in your terminal. Use a command manager like rbw (Bitwarden CLI) or pass.

influx-dump --host http://localhost:8086 \
            --org my-org \
            --bucket my-bucket \
            --token-cmd 'rbw get -f "API Token" InfluxDB'

Deep Analysis (Values & Ranges)

Analyze values to see unique tag values and field ranges (Min/Max).

influx-dump --host http://localhost:8086 \
            --org my-org \
            --bucket my-bucket \
            --token-cmd '...' \
            --show-values

Export to JSON

Generate a machine-readable schema definition.

influx-dump --host http://localhost:8086 \
            --org my-org \
            --bucket my-bucket \
            --token-cmd '...' \
            --format json > schema.json

Advanced Filtering

Scan a specific time range or scan everything (use with caution on huge buckets).

# Scan last 24 hours with a higher limit per measurement
influx-dump ... --range "-24h" --limit 1000

# Scan EVERYTHING (start from epoch 0, no limit)
influx-dump ... --all --show-values

CLI Options

Usage: influx-dump [OPTIONS] --bucket <NAME> --org <ORG>

Options:
      --host <URL>           InfluxDB Host URL [default: http://localhost:8086]
  -o, --org <NAME>           Organisation Name
  -b, --bucket <NAME>        Bucket Name
  -t, --token <STRING>       Authentication Token (V2)
      --token-cmd <CMD>      Command to retrieve the Auth Token
  -u, --user <STRING>        Username (Basic Auth fallback)
      --password-cmd <CMD>   Command to retrieve the Password
  -r, --range <DURATION>     Time range to scan (e.g., "-1h", "-30d"). Defaults to last 30 days.
  -l, --limit <N>            Limit records per measurement [default: 100]
  -a, --all                  Scan ALL data (sets range to start: 0, disables limit)
      --format <TYPE>        Output format: "text" or "json" [default: text]
      --show-values          Analyze tag values and field min/max/unique values
      --verbose-types        Show all discovered types per field, not just the dominant one
  -h, --help                 Print help
  -V, --version              Print version