Skip to content

Stages

A stage is a processing step in a bgpipe pipeline. Each stage performs a specific task: connecting to a BGP speaker, filtering messages, writing to a file, and so on. Stages are composed left-to-right on the command line, separated by --.

bgpipe [OPTIONS] [--] STAGE1 [OPTIONS] [ARGS] [--] STAGE2 [OPTIONS] [ARGS] ...

Available Stages

Connection

Stage Description
connect Connect to a BGP endpoint over TCP
listen Accept an incoming BGP connection over TCP
speaker Run a simple BGP speaker

Input / Output

Stage Description
stdin Read messages from standard input
stdout Write messages to standard output
read Read messages from a file or URL
write Write messages to a file

Filtering

Stage Description
grep Keep messages matching a filter; drop the rest
drop Drop messages matching a filter; keep the rest
tag Add or remove message tags
limit Enforce prefix length and count limits
head Stop the pipeline after N messages

Modification

Stage Description
update Modify UPDATE message attributes

External Processing

Stage Description
exec Pipe messages through an external process
pipe Exchange messages through a named pipe (FIFO)
websocket Exchange messages over WebSocket

Live Streaming

Stage Description
ris-live Stream BGP updates from RIPE RIS Live
rv-live Stream BGP updates from RouteViews via Kafka

Security

Stage Description
rpki Validate UPDATE messages using RPKI

Common Options

Every stage accepts the following options:

Option Description
-L, --left Operate in the L (left) direction
-R, --right Operate in the R (right) direction
-A, --args Consume all remaining CLI arguments until --
-W, --wait events Wait for given event(s) before starting
-S, --stop events Stop the stage after given event(s)
--rate-limit N Delay messages to stay under N messages/sec
--rate-sample N Randomly sample messages when over N messages/sec

In --wait and --stop, multiple events can be comma-separated. If you refer a stage name (e.g., listen), the event is expanded by appending /READY (e.g., listen/READY), which is emitted when the stage is ready to process messages (e.g., after accepting a new connection). You can also refer to custom events emitted by stages (e.g., grep/match).

Stages that support input or output filtering:

Option Description
-I, --if filters Input filter: skip capturing messages that don't match all the filters
-O, --of filters Output filter: drop produced messages that don't match all the filters

Direction

By default, stages operate in the right (-R) direction, processing messages flowing left-to-right. The last stage that connects to a BGP endpoint defaults to the left (-L) direction instead. Use -LR for bidirectional processing.

See Also

Quick Start, Examples, Message Filters, JSON Format