ReferenceCLI Flags

CLI Flags

Complete command-line reference for flokbn

Command Structure

flokbn [global options] command [command options]

Three commands: static (historical log analysis), live (real-time monitoring), and generate (generate ready-to-run example inputs).

Global Options

FlagDescription
--help, -hShow help
--version, -vPrint the version

Static Mode

flokbn static [options]

Core Options

FlagTypeRequiredDefaultDescription
--configstringNo-Path to TOML config file. When used, only --tui, --compact, --plain are allowed alongside it. All other flags produce an error.
--logfilestringYes (unless --config)-Path to log file to analyze. Note: the CLI flag is all-lowercase --logfile; the equivalent TOML key is camelCase logFile. This divergence is intentional.
--logFormatstringNo%^ %^ %^ [%t] "%r" %s %b %^ "%u" "%h"Log format string. See Log Formats.
--startTimestringNo-Start of time window. Formats: YYYY-MM-DD, YYYY-MM-DD HH, YYYY-MM-DD HH:MM
--endTimestringNo-End of time window. Same formats as --startTime

Clustering Options

FlagTypeRequiredDefaultDescription
--clusterArgSetsstringNo1000,30,32,0.2 (injected)Comma-separated minSize,minDepth,maxDepth,threshold. Repeatable. If omitted, flags mode injects the default set 1000,30,32,0.2 (jailed), matching live flags mode - clusters are still detected and jailed. Note: a [static.NAME] TOML trie has no such default - without clusterArgSets it detects nothing. See Clustering.

Filtering Options

FlagTypeDescription
--useragentRegexstringRegex to filter by User-Agent
--endpointRegexstringRegex to filter by URL path
--whiteliststringPath to IP/CIDR whitelist file
--blackliststringPath to IP/CIDR blacklist file
--userAgentWhiteliststringPath to User-Agent whitelist file
--userAgentBlackliststringPath to User-Agent blacklist file

See Filtering for file formats.

Analysis Options

FlagTypeDescription
--rangesCidrstringAnalyze specific CIDR range. Repeatable. Note: the CLI flag is --rangesCidr; the equivalent TOML key is cidrRanges (word order swapped). This divergence is intentional.
--plotPathstringPath for HTML heatmap output

Output Options

FlagTypeDefaultDescription
--plainboolfalseHuman-readable plain text output
--compactboolfalseSingle-line JSON output
--tuiboolfalseInteractive terminal UI

Default output (no flag) is pretty-printed JSON. See Output Formats.

Ban Management Options

FlagTypeDescription
--jailFilestringPath to jail state file (JSON)
--banFilestringPath to ban list output (CIDRs plus # comment headers)

Static mode writes the jail and ban files only when both flags are set; with only one of them, no jail/ban output is produced. All cluster arg sets passed via --clusterArgSets count toward jailing (matching live mode; per-set control is config-file only). Note that the jail file is only created when at least one range was actually jailed - a run with no detections leaves no jail file, while the ban file is always written (header-only if empty).


Live Mode

flokbn live [options]

Core Options

FlagTypeRequiredDefaultDescription
--configstringNo-Path to TOML config file. When used, only --logLevel is allowed alongside it.
--portstringYes (unless --config)-Port for Lumberjack protocol listener
--jailFilestringYes (unless --config)-Path to jail state file (JSON)
--banFilestringYes (unless --config)-Path to ban list output (CIDRs plus # comment headers)
--logLevelstringNoinfoVerbosity of the live-mode log lines on stderr: debug, info, warn, or error. Overrides the [log] level from the config file.

Live mode logs leveled, timestamped progress lines to stderr (one summary line per detection iteration). Machine-readable live data is served by the HTTP endpoints (GET /stats, GET /bans, Prometheus GET /metrics) when statsListen is configured.

Window Options

FlagTypeDefaultDescription
--slidingWindowMaxTimeduration2h0m0sMaximum time span of sliding window
--slidingWindowMaxSizeint100000Maximum requests in sliding window
--sleepBetweenIterationsint10Seconds between detection iterations

Flags-only live mode creates a single sliding window (internally named cli_default). Multiple windows, the HTTP stats server (statsListen, topTalkers), and the ingestor readTimeout are only available via --config - there are no CLI flags for them. See Config File.

Clustering Options

FlagTypeDescription
--clusterArgSetstringComma-separated minSize,minDepth,maxDepth,threshold. Repeatable. Note: singular form (not --clusterArgSets). When omitted, a default set of 1000,30,32,0.2 is used. All sets passed this way are jailed (useForJail true).

Filtering Options

Live mode supports the same filter flags as static mode: --useragentRegex, --endpointRegex, --whitelist, --blacklist, --userAgentWhitelist, --userAgentBlacklist.

--rangesCidr, --plotPath, --plain, --compact, and --tui are static-only flags - the live command rejects them with an error. Live mode produces log lines, the jail/ban files, and the optional HTTP endpoints, not a report.


Generate Mode

flokbn generate <subcommand> [options]

Generates ready-to-run example inputs so you can try the full analysis without a Go toolchain or your own logs.

generate static-demo

flokbn generate static-demo [--out <dir>]

Writes a complete, self-contained static-analysis demo into the directory given by --out: a fixed 1,000,000-line synthetic access log (access.log), the matching complex static-analysis configuration whose cluster thresholds are calibrated for that log, and the four IP/UA list files the config references. Every path in the generated config is rewritten to an absolute, co-located target, so it runs from any working directory.

The synthetic log is deterministic, with a known traffic shape (weighted /16 hotspots over a uniform public-IP background, Zipf endpoint popularity, and exact-match whitelist User-Agents). There is no line-count flag - the demo always generates exactly 1,000,000 lines.

FlagTypeRequiredDefaultDescription
--outdirectoryNo. (current directory)Directory to create the demo in. Receives the generated access.log, the calibrated config, and the IP/UA list files.

A complete run from the binary alone:

flokbn generate static-demo --out ./demo
flokbn static --config ./demo/complex-static.toml --plain

Running the analysis additionally writes heatmap.html, flokbn_jail.json, and flokbn_ban.txt into the same directory.


Exit Codes

CodeDescription
0Success
1Any error (invalid arguments, file not found, configuration error). The message is printed to stdout/stderr.

CLI vs Config File

Use CLI flags when…Use --config when…
Quick ad-hoc analysisProduction deployments
Scripting and automationMultiple tries/windows
Testing parametersReproducible configurations
Simple single-trie runsLive mode

Both build the same internal *config.Config struct. See Config File for TOML format.