Configure Traffic Sampling Output
You can configure the following traffic sampling output statements:
[edit forwarding-options sampling output]aggregate-export-intervalseconds;cflowdhostname{aggregation {autonomous-system;destination-prefix;protocol-port;source-destination-prefix {caida-compliant;}source-prefix;}autonomous-system-type (origin | peer);(local-dump | no-local-dump);portport-number;source-addressaddress;versionformat;}file {disable;filenamefilename;filesnumber;sizebytes;(stamp| no-stamp);(world-readable| no-world-readable);}flow-active-timeoutseconds;flow-inactive-timeoutseconds;interfaceinterface-name{engine-idnumber;engine-typenumber;source-addressaddress;}To direct sampled traffic to a flow-monitoring interface, include the
interfacestatement. Theengine-idandengine-typestatements specify the identity and type numbers of the interface; they are dynamically generated based on the FPC, PIC, and slot numbers and the chassis type. Thesource-addressstatement specifies the traffic source.For information on cflowd, see Configure cflowd. The
aggregate-export-intervalstatement is described in Configure Discard Accounting, and the flow-active-timeoutandflow-inactive-timeoutstatements are described in Configure Flow Monitoring.Traffic sampling results are automatically saved to a file in the
/var/tmpdirectory.To collect the sampled packets in a file, include thefilestatement at the[edit forwarding-options sampling output]hierarchy level:[editforwarding-options sampling output]file {disable;filenamefilename;filesnumber;sizebytes;(stamp| no-stamp);(world-readable| no-world-readable);}Traffic Sampling Output Files
Traffic sampling output is saved to an ASCII text file. The following is an example of the traffic sampling output that is saved to a file in the
/var/tmpdirectory. Each line in the output file contains information for one sampled packet. You can optionally display a timestamp for each line.The column headers are repeated after each group of 1000 packets.
# Apr 7 15:48:50Time Dest Src Dest Src Proto TOS Pkt Intf IP TCPaddr addr port port len num frag flagsApr 7 15:48:54 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0Apr 7 15:48:55 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0Apr 7 15:48:56 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0Apr 7 15:48:57 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0Apr 7 15:48:58 192.168.9.194 192.168.9.195 0 0 1 0x0 84 8 0x0 0x0To set the timestamp option for the file
my-sample, enter the following:[edit forwarding-options sampling output file]user@host#set filename my-sample files 5 size 2m world-readable stamp;Whenever you toggle the timestamp option, a new header is included in the file. If you set the
stampoption, theTimefield is displayed.# Apr 7 15:48:50# Time Dest Src Dest Src Proto TOS Pkt Intf IP TCP# addr addr port port len num frag flags# Feb 1 20:31:21# Dest Src Dest Src Proto TOS Pkt Intf IP TCP# addr addr port port len num frag flags