BGPReader is a command line tool that prints to standard output information about the BGP records and the BGP elems that are part of a BGP stream.


BGPReader requires the user to specify the stream time interval (in Unix epoch), and it accepts the following command line options:

usage: bgpreader -w <start>[,<end>] [<options>]

data interface options

   -d <interface> use the given data interface to find available data
                  available data interfaces are:
       broker         Retrieve metadata information from the BGPStream Broker service (default)
       singlefile     Read a single mrt data file (a RIB and/or an update)
       csvfile        Retrieve metadata information from a csv file
       sqlite         Retrieve metadata information from a sqlite database
   -o <option-name,option-value>*
                  set an option for the current data interface.
                  use '-o ?' to get a list of available options for the current
                  data interface. (data interface can be selected using -d)

The default data interface is the broker which allows BGPReader to provide out-of-the-box access to Route Views and RIPE RIS data. Data interface parameters can be set using the -o option.

stream filters options

   -p <project>   process records from only the given project (routeviews, ris)*
   -c <collector> process records from only the given collector*
   -t <type>      process records with only the given type (ribs, updates)*
   -w <start>[,<end>]
                  process records within the given time window specified as Unix
                  epoch (omitting the end parameter enables live mode)*
   -P <period>   process a rib files every <period> seconds (bgp
   -j <peer ASN>  return valid elems originated by a specific peer ASN*
   -k <prefix>    return valid elems associated with a specific prefix*
   -y <community> return valid elems with the specified community*
                  (format: asn:value, the '*' metacharacter is recognized)
   -l             enable live mode (make blocking requests for BGP records)
                  allows bgpstream to be used to process data in

Information about available collectors and the associated time intervals are available at the Data Providers page.

output format options

   -e             print info for each element of a valid BGP record (default)
   -m             print info for each BGP valid record in bgpdump -m format
   -r             print info for each BGP record (used mostly for debugging BGPStream)
   -i             print format information before output

(The * denotes an option that can be given multiple times.)

ASCII Output Formats

Below we provide details about the following formats:

BGP Elem Format (default)


The dump-type field is one of:

  • R - RIB
  • U - Update

The elem-type field is one of:

  • R - RIB
  • A - announcement
  • W - withdrawal
  • S - state message

When the stream contains RIB data, we also provide RIB control messages to notify the beginning and the end of a RIB. The control messages have the following format:


Where the dump-type field is always set to R, and the dump-pos is either:

  • B - begin
  • E - end


$ bgpreader -w 1445306400,1445306402 -c route-views.sfmix
R|R|1445306400|routeviews|route-views.sfmix|32354||||32354 15169|15169|||
R|R|1445306401|routeviews|route-views.sfmix|14061|2001:504:30::ba01:4061:1|2c0f:ffd8::/32|2001:504:30::ba01:4061:1|14061 1299 33762|33762|1299:30000||
R|R|1445306401|routeviews|route-views.sfmix|32354|2001:504:30::ba03:2354:1|2c0f:ffd8::/32|2001:504:30::ba00:6939:1|32354 6939 37105 33762|33762|||
R|R|1445306401|routeviews|route-views.sfmix|14061|2001:504:30::ba01:4061:1|3803:b600::/32|2001:504:30::ba01:4061:1|14061 2914 3549 27751|27751|2914:420 2914:1008 2914:2000 2914:3000||
U|A|1445306401|routeviews|route-views.sfmix|32354|2001:504:30::ba03:2354:1|2402:ef35::/32|2001:504:30::ba03:2354:1|32354 6939 6453 4755 7633|7633|||
U|A|1445306401|routeviews|route-views.sfmix|14061|2001:504:30::ba01:4061:1|2a02:158:200::/39|2001:504:30::ba01:4061:1|14061 2914 44946|44946|2914:410 2914:1201 2914:2202 2914:3200||

BGPdump output format -m

BGPReader supports the bgpdump one-line per entry with unix timestamps output format. See the BGPdump website for more information.


$ bgpreader -w 1445306400,1445306402 -p ris -m
BGP4MP|1445306400|A||24482||24482 7029 40377|IGP||0|8000|7029:260 7029:1001 7029:1002 24482:2 24482:13020 24482:13021 24482:65302|NAG||
BGP4MP|1445306400|A||6939||6939 12389 41938 8359 50618 35189 201432|IGP||0|0||NAG||
BGP4MP|1445306400|A||1836||1836 6939 12389 41938 8359 50618 35189 201432|IGP||0|0|1836:120 1836:3100 1836:3110|NAG||
BGP4MP|1445306402|A|2001:504:1::a501:3030:1|13030|2001:7fb:fe05::/48|13030 6939 12654|IGP|2001:504:1::a501:3030:1|0|1|13030:61 13030:1619 13030:51903|NAG||
BGP4MP|1445306402|A|2001:504:1::a501:3030:1|13030|2001:7fb:fe0e::/48|13030 6939 12654|IGP|2001:504:1::a501:3030:1|0|1|13030:61 13030:1619 13030:51903|NAG||
BGP4MP|1445306402|A|2001:504:1::a501:3030:1|13030|2001:7fb:fe10::/48|13030 6939 12654|IGP|2001:504:1::a501:3030:1|0|1|13030:61 13030:1619 13030:51903|NAG||
BGP4MP|1445306402|A|2001:504:1::a501:3030:1|13030|2001:7fb:fe04::/48|13030 20965 513 12654|IGP|2001:504:1::a501:3030:1|0|1|13030:61 13030:1611|NAG||

BGP Record output format -r

Note: The BGPRecord format is mostly useful for debugging BGPStream since it contains low-level information about the validity of records read from dump files.


The dump-type field can be:

  • R - RIB
  • U - Update

The dump-pos field is one of:

  • B - begin
  • M - middle
  • E - end

The status field is one of:

  • V - valid record
  • E - empty (it signals an empty dump file)
  • R - corrupted record
  • S - corrupted source (the entire dump is corrupted)


$ bgpreader -w 1445306400,1445306402 -c route-views.sfmix

Alternative data interfaces

Single-File -d singlefile


Data interface options for 'singlefile':
   rib-file       rib mrt file to read (default: "not-set")
   upd-file       updates mrt file to read (default: "not-set")

CSV File -d csvfile


Data interface options for 'csvfile':
   csv-file       csv file listing the mrt data to read  (default: "not-set")

SQLite DB -d sqlite


Data interface options for 'sqlite':
   db-file        sqlite database (default: "not-set")