read¶
Read messages from a file, URL, or standard input.
Synopsis¶
Description¶
The read stage reads BGP messages from a local file, a remote HTTP/HTTPS
URL, or standard input (use - as PATH) and injects them into the pipeline. It supports bidirectional operation
with -LR and uses the data to set each message direction. Without -LR,
messages are injected in the stage direction.
The input format is auto-detected by default. Detection first tries the file
extension (e.g., .mrt or .json), then falls back to sampling the file
contents. Supported formats include JSON (one message per line), MRT,
raw BGP wire format, ExaBGP line format, BMP (BGP Monitoring Protocol),
and OpenBMP.
For MRT, both BGP4MP update dumps (updates.*) and TABLE_DUMP /
TABLE_DUMP_V2 RIB snapshots (RouteViews rib.*, RIPE RIS bview.*) are
supported. RIB snapshots are converted into synthetic BGP UPDATE messages,
tagged with PEER_AS and PEER_IP. See MRT files for details
and use cases.
Compressed files are decompressed automatically when --decompress is set
to auto (the default). The compression format is detected from the file
extension: .gz (gzip), .bz2 (bzip2), .zst / .zstd (Zstandard).
For remote URLs, the stage streams data directly without downloading the entire file first, making it suitable for large MRT archives.
Options¶
| Option | Type | Default | Description |
|---|---|---|---|
--decompress |
string | auto |
Decompression: auto, gz, bzip2, zstd, or none |
--format |
string | auto |
Data format: json, raw, mrt, exa, bmp, obmp, or auto |
--type |
strings | Process only messages of given type(s) | |
--skip |
strings | Skip messages of given type(s) | |
--pardon |
bool | false |
Ignore input parsing errors |
--no-seq |
bool | false |
Overwrite input sequence numbers |
--no-time |
bool | false |
Overwrite input timestamps |
--no-tags |
bool | false |
Drop input message tags |
Examples¶
Read a compressed MRT file from the RIPE RIS archive:
Read a local MRT file and filter for a prefix:
Convert MRT to JSON:
Stream a RouteViews RIB snapshot as BGP UPDATEs:
Read a RIB snapshot under a non-standard name (content sampling cannot detect table dumps, so the format must be given explicitly):
Replay an MRT file into a live BGP session after establishment:
bgpipe \
-- speaker --active --asn 65001 \
-- read --wait ESTABLISHED updates.mrt.zst \
-- listen :179