Help us improve your experience.

Let us know what you think.

Do you have time for a two-minute survey?

 
 

Example: Configuring a Flow Collector Interface on an M, MX or T Series Router

Figure 1: Flow Collector Interface Topology DiagramFlow Collector Interface Topology Diagram

Figure 1 shows the path traveled by monitored traffic as it passes through the router. Packets arrive at input interfaces so-0/1/0, so-3/0/0, and so-3/1/0. The raw packets are directed into a filter-based forwarding routing instance and processed into flow records by the monitoring services interfaces mo-7/1/0, mo-7/2/0, and mo-7/3/0. The flow records are compressed into files at the flow collector interfaces cp-6/0/0 and cp-7/0/0 and sent to the FTP server for analysis. Finally, a mandatory class-of-service (CoS) configuration is applied to export channels 0 and 1 on the flow collector interfaces to manage the outgoing processed files.

Router 1

Verifying Your Work

To verify that your flow collector configuration is working, use the following commands on the monitoring station that is configured for flow collection:

  • clear services flow-collector statistics

  • request services flow-collector change-destination (primary | secondary)

  • request services flow-collector test-file-transfer

  • show services flow-collector file interface (detail | extensive | terse)

  • show services flow-collector (detail | extensive)

  • show services flow-collector input interface (detail | extensive | terse)

The following section shows the output of the show commands used with the configuration example:

To clear statistics for a flow collector interface, issue the clear services flow-collector statistics interface (all | interface-name) command.

Another useful flow collector option allows you to change the FTP server from primary to secondary and test for FTP transfers. To force the flow collector interface to use a primary or secondary FTP server, include the primary or secondary option when you issue the request services flow-collector change-destination interface cp-fpc/pic/port command.

If you configure only one primary server and issue this command with the primary option, you receive the error message “Destination change not needed.” If the secondary server is not configured and you issue this command with the secondary option, you receive the error message “Destination not configured.” Otherwise, when both servers are configured properly, successful output appears as follows.

Other options for the request services flow-collector change-destination interface cp-fpc/pic/port command are immediately (which forces an instant switchover), gracefully (the default behavior that allows a gradual switchover), clear-files (which purges existing data files), and clear-logs (which purges existing log files).

To verify that transfer log files are being scheduled for delivery to the FTP servers, issue the request services flow-collector test-file-transfer filename interface cp-fpc/pic/port command. Include the desired export channel (zero or one) and target FTP server (primary or secondary) with this command.

Another way you can check for the success of your file transfers is by analyzing the transfer log. A transfer log sends detailed information about files that are collected and processed by the flow collector interface. Table 1 explains the various fields available in the transfer log.

Table 1: Flow Collector Interface Transfer Log Fields

Field

Explanation

fn

Filename

sz

File size

nr

Number of records

ts

Timestamp with the format of year (4 digits), month (2 digits), day (2 digits), hours (2 digits), minutes (2 digits), and seconds (2 digits).

sf

Success flag—The values are 1 for success and 0 for failure.

ul

Server URL

rc

FTP result code

er

FTP error text

tt

Transfer time

This is an example of a successful transfer log:

This is an example of a transfer log when an FTP session fails:

As the flow collector interface receives and processes flow records, the PIC services logging process (fsad) handles the following tasks:

  • When the flow collector interface transfers a file to the FTP server, a temporary log file is created in the /var/log/flowc directory. The temporary log file has this filenaming convention:

    <hostname>_<filename_prefix>_ YYYYMMDD_hhmmss.tmp

    hostname is the hostname of the transfer server, filename_prefix is the same value defined with the filename-prefix statement at the [edit services flow-collector transfer-log-archive] hierarchy level, YYYYMMDD is the year, month, and date, and hhmmss is the timestamp indicating hours, minutes, and seconds.

  • After the log file has been stored in the router for the length of time specified by the maximum-age statement at the [edit services flow-collector transfer-log-archive] hierarchy level (the default is 120 minutes), the temporary log file is converted to an actual log file and the temporary file is deleted. The new log file retains the same naming conventions, except the extension is *.log.

  • When the final log file is created and compressed, the PIC services logging process (fsad) tries to send the log file from the /var/log/flowc directory to an FTP server. You can specify up to five FTP servers to receive the log files by including the archive-sites statement at the [edit services flow-collector transfer-log-archive] hierarchy level. The logging process attempts to send the log file to one server at a time, in order of their appearance in the configuration. Upon the first successful transfer, the log file is deleted and the logging process stops sending log files to the remaining FTP servers in the list.

  • If the log file transfer is not successful, the log file is moved to the /var/log/flowc/failed directory. Every 30 minutes, the logging process tries to resend the log files. After the log files are transferred successfully, they are deleted from the /var/log/flowc/failed directory.

    Note:

    If the memory for a flow collector interface is full, the interface might drop incoming packets.

After the flow collector interface successfully delivers the processed information file to the FTP server, you can analyze the file. The file contains detailed information about the flows collected and processed by the flow collector interface. Table 2 explains the various fields available in the flow collector interface file.

Table 2: Flow Collector Interface File Fields in Order of Appearance

Field

Explanation

linkDir

Link directory—A randomly generated number used to identify the record

analyzer-address

Analyzer address

analyzer-ID

Analyzer identifier

ifAlias

Interface identifier

source-address

Source address

destination-address

Destination address

packets

Number of packets

bytes

Number of bytes

start-time

Start time

end-time

End time

source-port

Source port

destination-port

Destination port

tcp_flag

TCP flag

protocol

IP protocol number

src_AS_number

Source AS number

dst_AS_number

Destination AS number

This is an example of output from a flow collector interface file: