docs/user/setup-pipeline.md

Pipeline setup

The pipeline is the Rust atlantis-netflow-db crate. It converts nfcapd or CSV input into a compatible SQLite database.

scripts/netflow-db.sh is the pipeline entry point. It runs the crate with cargo run --locked --release, which compiles it when necessary. The first run compiles the Rust dependencies and takes several minutes. Set NETFLOW_DB_BIN to run a prebuilt binary instead.

Use a new output database when you change selection rules or result semantics. The pipeline rejects incompatible reuse.

Build the nfdump fork

nfcapd input needs the pinned ATLANTIS nfdump fork. A system nfdump installation does not work: the pipeline uses an output mode that only the fork has. CSV input does not need nfdump.

The build needs the nfdump fork tools. The build script checks for them and names any tool that is missing.

  1. Initialize the Git submodules.

    bash
    1git submodule update --init --recursive
  2. Build the fork.

    bash
    1./vendor/scripts/compile-nfdump.sh

The build stages the executable at target/nfdump/libexec/nfdump. The target directory is disposable and git-ignored. Pass this path to each pipeline command with --nfdump; the pipeline does not find it automatically.

Process a dataset

First, complete the dataset configuration.

Run a bounded import while you test the configuration:

bash
1./scripts/netflow-db.sh pipeline \
2 --dataset example \
3 --start-date 2025-02-01 \
4 --end-date 2025-02-01 \
5 --nfdump target/nfdump/libexec/nfdump

The start date and end date are inclusive, so this command processes one day. If you omit the end date, the pipeline processes each day through the latest available day.

Dataset mode calculates MAAD statistics by default. MAAD statistics describe the multifractal structure of the observed IPv4 address sets, and they power the address-structure charts. Use --no-maad to skip them.

If a command fails, read Troubleshooting.

Select flows

Selection conditions use AND logic. The IP prefix can match the source endpoint or the destination endpoint.

bash
1./scripts/netflow-db.sh pipeline \
2 --dataset example \
3 --start-date 2025-02-01 \
4 --end-date 2025-02-01 \
5 --database-path data/example-public/netflow.sqlite \
6 --ip-prefix 192.0.2.0/24 \
7 --src-visibility literal \
8 --nfdump target/nfdump/libexec/nfdump

A selected population is a different database product. Thus, selection options require an explicit --database-path.

Available selection options are:

  • --ip-prefix
  • --src-visibility literal|anonymized
  • --dst-visibility literal|anonymized

Use a pipeline configuration

Configuration mode supports CSV input, nfcapd input, and mixed input. Explicit csv and nfcapd inputs and csv_tree and nfcapd_tree discovery inputs go in the top-level inputs list.

bash
1./scripts/netflow-db.sh pipeline \
2 --config /path/to/pipeline.json \
3 --database-path data/example/netflow.sqlite

Put flow selection in the top-level selection object:

json
1{
2 "selection": {
3 "ip_prefix": "192.0.2.0/24",
4 "src_visibility": "literal",
5 "dst_visibility": "anonymized"
6 },
7 "inputs": []
8}

For nfcapd input, set the top-level "nfdump" value to "target/nfdump/libexec/nfdump". You can also pass the same path with --nfdump when the configuration does not set it.

Common options

OptionPurpose
--database-pathChanges the SQLite output path.
--datasetsReads a different dataset registry file.
--start-timeSets the start of a half-open time window.
--end-timeSets the end of a half-open time window.
--nfdumpNames the nfdump executable.
--forceRewrites selected nfcapd buckets.
--no-maadSkips the MAAD statistics.

Time limits must align with local-day boundaries.

Verify the output

Run the compatibility check after the pipeline finishes:

bash
1./scripts/netflow-db.sh verify data/example/netflow.sqlite \
2 --dataset-id example \
3 --require-data \
4 --require-maad-data \
5 --require-processed \
6 --require-rollup-parity \
7 --require-no-raw-ip

The command prints an OK line when the database is compatible. A failed requirement returns a nonzero exit status.

For pipeline identity and export rules, read the pipeline contract.