man nfdump Command

Man page for apt-get nfdump Command

Man Page for nfdump in Linux

Ubuntu Man Command : man nfdump

Man Nfdump  Command

This tutorial shows the man page for man nfdump in linux.

Open terminal with 'su' access and type the command as shown below:
man nfdump

Result of the Command Execution shown below:

nfdump(1)                                                                                                                                                  nfdump(1)

nfdump netflow display and analyze program

nfdump [options] [filter]

nfdump is the netflow display and analyzing program of the nfdump tool set. It reads the netflow data from files stored by nfcapd and processes the flows
according the options given. The filter syntax is comparable to tcpdump and extended for netflow data. Nfdump can also display many different top N flow and
flow element statistics.

r inputfile
Read input data from inputfile. Default is read from stdin.

R expr
Read input from a sequence of files in the same directory. expr may be one of:
/any/dir Read recursively all files in directory dir.
/dir/file Read all files beginning with file.
/dir/file1:file2 Read all files from file1 to file2.

When using in combination with a sub hierarchy:
Read all files from sub1/sub2/file1 sub3/sub4/file2 iterating over all required hierarchy levels.

Note: files are read in alphabetical sequence.

M expr
Read input from multiple directories. expr looks like: /any/path/to/dir1:dir2:dir3 etc. and will be expanded to the directories: /any/path/to/dir1,
/any/path/to/dir2 and /any/path/to/dir3 Any number of colon separated directories may be given. The files to read are specified by r or R and are
expected to exist in all the given directories. The options r and R must not contain any directory part when used in conjunction with M.

m Sort the netflow records according the date first seen. This option is usually only useful in conjunction with M, when netflow records are read from dif Äê
ferent sources, which are not necessarily sorted.

w outputfile
If specified writes binary netflow records to outputfile ready to be processed again with nfdump. The default output is ASCII on stdout. In combination
with options m, a, b, and B write aggregated and/or sorted flow cache in binary format to disk.

f filterfile
Reads the filter syntax from filterfile. Note: Any filter specified directly on the command line takes precedence over f.

t timewin
Process only flows, which fall in the time window timewin, where timewin is YYYY/MM/dd.hh:mm:ss[ YYYY/MM/dd.hh:mm:ss]. Any parts of the time spec may be
omitted e.g YYYY/MM/dd expands to YYYY/MM/dd.00:00:00 YYYY/MM/dd.23:59:59 and processes all flow from a given day. The time window may also be specified
as +/ n. In this case it is relativ to the beginning or end of all flows. +10 means the first 10 seconds of all flows, 10 means the last 10 seconds of
all flows.

c num
Limit number of records to process to the first num flows.

a Aggregate netflow data. Automatically implies a. Aggregation is done at connection level by taking the 5 tuple protocol, srcip, dstip, srcport and dst Äê

A aggregation
Similar to Flexible Netflow (FNF), netflow records can be aggregated by any number of given v9 fields. aggregation is a ',' separated list of recognised
tags of the following list:
proto IP protocol
srcip Source IP address
dstip Destination IP address
srcip4/net IPv4 source IP address with applied netmask
srcip6/net IPv6 source IP address with applied netmask
dstip4/net IPv4 destination IP address with applied netmask
dstip6/net IPv6 destination IP address with applied netmask
srcnet Apply netmask srcmask in netflow record for source IP
dstnet Apply netmask dstmask in netflow record for dest IP
srcport Source port
dstport Destination port
srcmask Source mask
dstmask Destination mask
srcvlan Source vlan label
dstvlan Destination vlan label
srcas Source AS number
dstas Destination AS number
inif SNMP input interface number
outif SNMP output interface number
next IP next hop
bgpnext BGP next hop
insrcmac In source MAC address
outdstmac out destination MAC address
indstmac In destintation MAC address
outsrcmac Out source MAC address
tos Source type of service
srctos Source type of Service
dsttos Destination type of Service
mpls1 MPLS label 1
mpls2 MPLS label 2
mpls3 MPLS label 3
mpls4 MPLS label 4
mpls5 MPLS label 5
mpls6 MPLS label 6
mpls7 MPLS label 7
mpls8 MPLS label 8
mpls9 MPLS label 9
mpls10 MPLS label 10

nfdump automatically compiles an appropriate output format for the selected aggregation unless an explicit output format is given. The automatic output
format is identical to o 'fmt:%ts %td <fields> %pkt %byt %bps %bpp %fl' where <fields> represents the selected aggregation tags.

A proto,srcip,dstport

A srcas,dstas

b Aggregate netflow records as bidirectional flows. Automatically implies a. Aggregation is done on connection level by taking the 5 tuple protocol,
srcip, dstip, srcport and dstport, or the reverse order for the corresponding connection flow. Input and output packets/bytes are counted and reported
separate. Both flows are merged into a single record. An appropriate output format is selected automatically, which may be overwritten by any o format

B Like b but automagically swaps flows, such that src port is > 1024 and dst port is < 1024 as some exporters do not care sending the flows in proper
order. It's considered to be a convenient option. If src and dst port are > 1024 or < 1024, the flows are taken as is.

I Print flow statistics from file specified by r, or timeslot specified by R/ M.

D dns
Set dns as nameserver to lookup hostnames.

s statistic[:p][/orderby]
Generate the Top N flow or flow element statistic. statistic can be:
record Statistic about arregated netflow records.
srcip Statistic about source IP addresses
dstip Statistic about destination IP addresses
ip Statistic about any (source or destination) IP addresses
nhip Statistic about next hop IP addresses
nhbip Statistic about BGP next hop IP addresses
router Statistic about exporting router IP address
srcport Statistic about source ports
dstport Statistic about destination ports
port Statistic about any (source or destination) ports
tos Statistic about type of service default src
srctos Statistic about src type of service
dsttos Statistic about dst type of service
dir Statistic about flow directions ingress/egress
srcas Statistic about source AS numbers
dstas Statistic about destination AS numbers
as Statistic about any (source or destination) AS numbers
inif Statistic about input interface
outif Statistic about output interface
if Statistic about any interface
srcmask Statistic about src mask
dstmask Statistic about dst mask
srcvlan Statistic about src vlan label
dstvlan Statistic about dst vlan label
vlan Statistic about any vlan label
insrcmac Statistic about input src MAC address
outdstmac Statistic about output dst MAC address
indstmac Statistic about input dst MAC address
outsrcmac Statistic about output src MAC address
srcmac Statistic about any src MAC address
dstmac Statistic about any dst MAC address
inmac Statistic about any input MAC address
outmac Statistic about any output MAC address
mask Statistic about any mask
proto Statistic about IP protocols
mpls1 Statistic about MPLS label 1
mpls2 Statistic about MPLS label 2
mpls3 Statistic about MPLS label 3
mpls4 Statistic about MPLS label 4
mpls5 Statistic about MPLS label 5
mpls6 Statistic about MPLS label 6
mpls7 Statistic about MPLS label 7
mpls8 Statistic about MPLS label 8
mpls9 Statistic about MPLS label 9
mpls10 Statistic about MPLS label 10

By adding :p to the statistic name, the resulting statistic is split up into transport layer protocols. Default is transport protocol independent statis Äê

orderby is optional and specifies the order by which the statistics is ordered and can be flows, packets, bytes, pps, bps or bpp. You may specify more
than one orderby which results in the same statistic but ordered differently. If no orderby is given, statistics are ordered by flows. You can specify as
many s flow element statistics on the command line for the same run.

s srcip s ip/flows s dstport/pps/packets/bytes s record/bytes

O orderby
Specifies the default orderby for flow element statistics s, which applies when no orderby is given at s. orderby can be flows, packets, bytes, pps, bps
or bpp. Defaults to flows.

l [+/ ]packet_num
Limit statistics output to those records above or below the packet_num limit. packet_num accepts positive or negative numbers followed by 'K' , 'M' or 'G'
10E3, 10E6 or 10E9 flows respectively. See also note at L

L [+/ ]byte_num
Limit statistics output to those records above or below the byte_num limit. byte_num accepts positive or negative numbers followed by 'K' , 'M' or 'G'
10E3, 10E6 or 10E9 bytes respectively. Note: These limits only apply to the statistics and aggregated outputs generated with a s or S. To filter net Äê
flow records by packets and bytes, use the filter syntax 'packets' and 'bytes' described below.

n num
Define the number for the Top N statistics. Defaults to 10. If 0 is specified the number is unlimited.

o format
Selects the output format to print flows or flow record statistics ( s record). The following formats are available:
raw Print each file flow record on multiple lines.
line Print each flow on one line. Default format.
long Print each flow on one line with more details
biline Same as line, but for bidir flows
bilong Same as long, but for bidir flows
extended Print each flow on one line with even more details.
csv Comma separated output for machine readable processing.
pipe Legacy machine readable format: fields '|' separated.
fmt:format User defined output format.
For each defined output format except o fmt:<format> an IPv6 long output format exists. line6, long6 and extended6. See output formats below for more

K key
Anonymize all IP addresses using the CryptoPAn (Cryptography based Prefix preserving Anonymization) module. The key is used to initialize the Rijndael
cipher. key is either a 32 character string, or a 64 hex digit string starting with 0x. Anonymizing takes place after applying the flow filter, but before
printing the flow or writing the flow to a file.

See for more information about CryptoPAn.

q Suppress the header line and the statistics at the bottom.

N Print plain numbers in output. Easier for post parsing.

i ident
Change ident label in file, specified by r to ident

v file
Verify file. Print data file version, number of blocks and compression status.

x file
Scan and print extension maps located in file file

z Compress flows. Use fast LZO1X 1 compression in output file.

j file
Compress/Uncompress a given file. If the file is compressed, uncompress it and vice versa.

Z Check filter syntax and exit. Sets the return value accordingly.

X Compiles the filer syntax and dumps the filter engine table to stdout. This is for debugging purpose only.

V Print nfdump version and exit.

h Print help text on stdout with all options and exit.

0 No error.
255 Initialization failed.
254 Error in filter syntax.
250 Internal error.

The output format raw prints each flow record on multiple lines, including all information available in the record. This is the most detailed view on a flow.

Other output formats print each flow on a single line. Predefined output formats are line, long and extended The output format line is the default output
format when no format is specified. It limits the imformation to the connection details as well as number of packets, bytes and flows.

The output format long is identical to the format line, and includes additional information such as TCP flags and Type of Service.

The output format extended is identical to the format long, and includes additional computed information such as pps, bps and bpp.


Date flow start: Start time flow first seen. ISO 8601 format including miliseconds.

Duration: Duration of the flow in seconds and miliseconds. If flows are aggregated, duration is the time span over the entire periode of time from first
seen to last seen.

Proto: Protocol used in the connection.

Src IP Addr:Port: Source IP address and source port.

Dst IP Addr:Port: Destination IP address and destination port. In case of ICMP, port is decodes as type.code.

Flags: TCP flags ORed of the connection.

Tos: Type of service.

Packets: The number of packets in this flow. If flows are aggregated, the packets are summed up.

Bytes: The number of bytes in this flow. If flows are aggregated, the bytes are summed up.

pps: The calculated packets per second: number of packets / duration. If flows are aggregated this results in the average pps during this periode of

bps: The calculated bits per second: 8 * number of bytes / duration. If flows are aggregated this results in the average bps during this periode of time.

Bpp: The calculated bytes per packet: number of bytes / number of packets. If flows are aggregated this results in the average bpp during this periode of

Flows: Number of flows. If flows are listed only, this number is alwasy 1. If flows are aggregated, this shows the number of aggregated flows to one

Numbers larger than 1'000'000 (1000*1000), are scaled to 4 digits and one decimal digit including the scaling factor M, G or T for cleaner output, e.g. 923.4

To make the output more readable, IPv6 addresses are shrinked down to 16 characters. The seven most and seven least digits connected with two dots '..' are
displayed in any normal output formats. To display the full IPv6 address, use the appropriate long format, which is the format name followed by a 6.

Example: o line displays an IPv6 address as 2001:23..80:d01e where as the format o line6 displays the IPv6 address in full length
2001:234:aabb::211:24ff:fe80:d01e. The combination of o line 6 is equivalent to o line6.

The output format fmt:<format> allows you to define your own output format. A format description format consists of a single line containing arbitrary
strings and format specifier as described below

%ts Start Time first seen
%te End Time last seen
%td Duration
%pr Protocol
%sa Source Address
%da Destination Address
%sap Source Address:Port
%dap Destination Address:Port
%sp Source Port
%dp Destination Port
%nh Next hop IP Address
%nhb BGP Next hop IP Address
%ra Router IP Address
%sas Source AS
%das Destination AS
%in Input Interface num
%out Output Interface num
%pkt Packets default input
%ipkt Input Packets
%opkt Output Packets
%byt Bytes default input
%ibyt Input Bytes
%obyt Output Bytes
%fl Flows
%flg TCP Flags
%tos Tos default src
%stos Src Tos
%dtos Dst Tos
%dir Direction: ingress, egress
%smk Src mask
%dmk Dst mask
%fwd Forwarding Status
%svln Src vlan label
%dvln Dst vlan label
%ismc Input Src Mac Addr
%odmc Output Dst Mac Addr
%idmc Input Dst Mac Addr
%osmc Output Src Mac Addr
%mpls1 MPLS label 1
%mpls2 MPLS label 2
%mpls3 MPLS label 3
%mpls4 MPLS label 4
%mpls5 MPLS label 5
%mpls6 MPLS label 6
%mpls7 MPLS label 7
%mpls8 MPLS label 8
%mpls9 MPLS label 9
%mpls10 MPLS label 10
%eng Engine type/ID
%bps bps bits per second
%pps pps packets per second
%bpp bps Bytes per package

Example: the standard output format long can be created as
o "fmt:%ts %td %pr %sap > %dap %flg %tos %pkt %byt %fl"

You may also define your own output format and have it compiled into nfdump. See nfdump.c section Output Formats for more details.

The csv output format is intended to be read by another program for further processing. As an example, see the Perl program. The cvs output
format consists of one or more output blocks and one summary block. Each output block starts with a cvs index line followed by the cvs record lines. The
index lines describes the order, how each following record is composed.

Index line: ts,te,td,sa,da,sp,dp,pr,...
Record line: 2004 07 11 10:30:00,2004 07 11 10:30:10,10.010,...

All records are in ASCII readable form. Numbers are not scaled, so each line can easly be parsed.

Indices used in nfdump 1.6:

ts,te,td time records: t start, t end, duration
sa,da src dst address sp,dp src, dst port
pr protocol PF_INET or PF_INET6
flg TCP Flags:
000001 FIN.
000010 SYN
000100 RESET
001000 PUSH
010000 ACK
100000 URGENT
e.g. 6 => SYN + RESET
fwd forwarding status
stos src tos
ipkt,ibyt input packets/bytes
opkt,obyt output packets, bytes
in,out input/output interface SNMP number
sas,das src, dst AS
smk,dmk src, dst mask
dtos dst tos
dir direction
nh,nhb nethop IP address, bgp next hop IP
svln,dvln src, dst vlan id
ismc,odmc input src, output dst MAC
idmc,osmc input dst, output src MAC
mpls1,mpls2 MPLS label 1 10
ra router IP
eng router engine type/id

See for more details.

The filter syntax is similar to the well known pcap library used by tcpdump. The filter can be either specified on the command line after all options or in
a separate file. It can span several lines. Anything after a '

Related Topics

Apt Get Commands