NFCAPD(1)
๐ฆ nfcapd(1) โ General Commands Manual ๐ฆ
okay bestie, buckle up, we're reading a manpage together and honestly? it's a good one ๐
โจ NAME โจ
nfcapd โ flow collector for netflow version v1, v5/v7 v9 and ipfix ๐ธ
๐ SYNOPSIS ๐
nfcapd -w flowdir [-C config] [-z=<compress>] [-j] [-y] [-l flowdir]
[-T] [-E] [-Z] [-D] [-u userid] [-g groupid] [-S num]
[-t interval] [-P pidfile] [-p port] [-d device] [-I ident]
[-b bindhost] [-f pcapfile] [-4] [-6] [-J mcastgroup]
[-R repeater] [-A] [-B buffsize] [-n sourceparam]
[-M multiflowdir] [-s rate] [-i metricrate] [-m metricpath] [-e]
[-x command] [-X extensionList] [-W workers] [-Y yaf-file]
[-v level] [-V] [-h]
๐ DESCRIPTION ๐
okay so nfcapd is a flow collector โ it reads netflow data straight off the network and stores those records into binary formatted files. and the way it just accepts netflow v1, v5/v7, v9 and ipfix transparently?? iconic. it doesn't even make you pick. ๐
it's mostly compatible with a whole bunch of other flow implementations like cflow, jflow, pflow, and it accepts a wide range of exporters including CISCO Flexible Netflow (FNF), ASA firewalls and NAT devices for event logging. it also has support for a wide range of different vendors and their netflow implementations, such as Juniper, VMware, PaloAlto devices and yaf. highkey a glow-up for your whole rack โจ
Sflow is a different technology. not the same thing, bestie, don't come for me.
nfcapd supports a large number of netflow v9 and ipfix elements according to the IANA assignments. yes, all of them. she studied. ๐
if you want to collect sflow data, please have a look at sfcapd โ which is also part of the nfdump tools ๐ซถ
nfcapd also accepts pre-processed records from its companion collector nfpcapd. so they're a duo, a collab, a joint slay ๐
nfcapd saves the flows in an output file, which is automatically rotated at a given interval โ typically every 5min. these rotated output files are stored in the flowdir directory and are organized by timestamps ๐ธ
the output files are named according to the time interval in the following format:
nfcapd.YYYYMMddhhmm
e.g. nfcapd.202207110845 which contains flow data from July 11th 2022 08:45 onwards.
and if the rotation interval is set to a time smaller then 60s, the naming extends to seconds, e.g. nfcapd.20220711084510 โฑ๏ธ
nfcapd can run in auto-expire mode with -e, which automatically expires old flow files at the end of every rotation interval. nfexpire(1) explains in more details how to setup flow expiration ๐
nfcapd can run any given command -x or shell script at the end of each rotation interval ๐ฅ
nfcapd can send universal flow metric information about the collected flow data (flow summary) to a UNIX socket. programs such as nfinflux or nfexporter may be used to send the metric information to an InfluxDB or to a Prometheus monitoring system. metrics bestie, we love to see it ๐
๐ The options are as follows ๐
-w flowdirโ set the flowdir directory to store the output files. if a sub hierarchy is specified with-S, the final directory is concatenated toflowdir/subdir๐ธ-C configโ reads additional configuration parameters from config file.nfcapdtries to read the config file from the install default path$prefix/etc/which may be overwritten by the environment variableNFCONF, which again is overwritten by this option-C. and if-C noneis specified, then no config file is read, even if found in the search path. respect the hierarchy bestie, it's giving chain of command ๐-p portnumโ set the port number to listen. default port is 9995 ๐-d interfaceโ reads flow data from an erspan encoded datalink. all traffic sent to this interface is interpreted as flow data stream.-b bindhostโ specifies the hostname/IPv4/IPv6 address to bind for listening. this can be an IP address or a hostname, resolving to a local IP address.-4โ forcesnfcapdto listen on IPv4 addresses only. can be used together with-bif a hostname has IPv4 and IPv6 addresses.-6โ forcesnfcapdto listen on IPv6 addresses only. can be used together with-bif a hostname has IPv4 and IPv6 addresses.-J mcastgroupโ join the specified IPv4 or IPv6 multicast group for listening. group chat but make it packets ๐ฌ-Y yaffileโ offline mode: read flows from yaf file, created by the yaf flow-collector. disables reading flows from network.-f pcapfileโ offline mode: read flows from pcap file, instead of the network. need--enable-readpcapfor configure โ ๏ธ-R host[/port]โ enables the packet repeater. all incoming packets are sent additionally to another host and port. host is either a valid IPv4/IPv6 address, or a symbolic hostname, which resolves to a valid IP address. port may be omitted and defaults to 9995.
Note: as IPv4/IPv6 are accepted, the host/port separator is /. up to 8 additional repeaters may be defined. use this method to daisy chain collectors ๐ผ
-Aโ sets source address spoofing mode for the repeater. the source address of the repeated packages is set to the original IP address. this needsnfcapdto be started with root privileges.
heads up bestie: source spoofing may be blocked by firewalls or routers in your network. don't come crying to me ๐ญ
-I identโ sets ident as identification string for the current source. this string is written into the output file to identify the source. default is'none'. if you have multiple sources, see option-nbelow ๐-n 'ident,IPList,flowdir'โ configures a NetFlow/IPFIX source identified by the stringident,IPList,flowdir. theIPListis a semicolon-separated list of one or more IP addresses or CIDR blocks, and may include both IPv4 and IPv6 addresses. for example:
-n 'router1,192.0.2.1;2001:db8::1/64,in'
note: the entire argument must be enclosed in single quotes to prevent the shell from interpreting the semicolon as a command separator. shell said "not today" and we said "no fr, quoted" ๐ซถ
this option also acts as a filter: only packets originating from IP addresses listed in IPList will be accepted. packets from sources not matching any entry in the list are silently discarded ๐
if you have multiple sources per collector, specify multiple -n options. all exporters send their flows to the same port specified with -p. do not mix single-source configuration using -I with multiple -n options. pick a lane bestie ๐
-M flowdirโ set the flowdir directory for dynamic allocated exporters. new exporters are dynamically added when sending data. all exporters send netflow data to the same port and IP. for each dynamically added source, a new sub directory is created under flowdir with the name of the IP address of the exporter. all'.'and':"'in IP addresses are replaced be'-'๐ฆ-Dโ set daemon mode: fork to background and detach from terminal.nfcapdterminates on signalTERM,INTorHUP. main character energy, she leaves the group chat but you can still reach her ๐-P pidfileโ writes the running process ID into pidfile. use this option to integratenfcapdin start/stop files.-u useridโ drop privileges of running process to user userid.nfcapdneeds to be started as user root โ ๏ธ-g groupidโ drop privileges of running process to group groupid.nfcapdneeds to be started as user root โ ๏ธ-B bufflenโ sets the network socket input buffer to bufflen bytes. for high volume traffic it is recommended to raise this value to typically > 100k, otherwise you risk to lose packets. the default is OS (and kernel) dependent ๐ญ-S numโ adds an additional directory sub hierarchy to store the data files. the default is 0, no sub hierarchy, which means all files go directly into flowdir. the flowdir is concatenated with the specified sub hierarchy format to create the final data directory. the following hierarchies are defined:
0 default no hierarchy levels
1 %Y/%m/%d year/month/day
2 %Y/%m/%d/%H year/month/day/hour
3 %Y/%W/%u year/week_of_year/day_of_week
4 %Y/%W/%u/%H year/week_of_year/day_of_week/hour
5 %Y/%j year/day-of-year
6 %Y/%j/%H year/day-of-year/hour
7 %Y-%m-%d year-month-day
8 %Y-%m-%d/%H year-month-day/hour
-t intervalโ sets the time interval in seconds to rotate files. the default value is 300s (5min). the smallest available interval is 2s โฑ๏ธ-s rateโ set the default sampling rate for flow records from exporters that do not announce a sampling rate. the default is 1 (unsampled). a positive rate from 1 through 10000000 is used only when the exporter does not provide sampling information. a negative value in the same range forces its absolute value for all records and overrides exporter-provided sampling information. sampling multiplies the packet and byte counters in a record; it may therefore differ from counters reported by SNMP or other sources. do the math bestie, don't blame the collector ๐งฎ-z=lzoโ compress flow files with LZO1X-1 compression. fastest compression โก-zโ legacy shorthand for-z=lzo.-z=bz2โ compress flow files with bz2 compression. slow but most efficient. it is not recommended to use bz2 in a real time capturing. she's a slow queen but she delivers ๐-z=lz4[:level]โ compress flow files with LZ4 compression. fast and efficient. optional level should be between 1..10. changing the level results in smaller files but uses up more time to compress. levels > 5 may need more workers. see-W๐-z=zstd[:level]โ compress flow files with ZSTD compression. fast and efficient. optional level should be between 1..10. changing the level results in smaller files but uses up more time to compress. levels > 5 may need more workers. see-W๐-jโ legacy shorthand for-z=bz2.-yโ legacy shorthand for-z=lz4.-l flowdirโ legacy alias for-w flowdir.-Tโ legacy option accepted and ignored. she's here, she's not doing anything, she's still invited ๐ธ-Eโ deprecated debugging shorthand for-v -3โ ๏ธ-Zโ append the local time-zone offset to generated filenames ๐-W numโ set the number of worker threads. the default depends on the number of cores online. the value must not exceed the number of online CPU cores. worker threads are used to compress data blocks when writing flow files to disc. using multiple workers can significantly improve throughput, especially when using higher compression levels for lz4 or zstd. teamwork makes the dream work ๐ซถ-eโ sets auto-expire mode. at the end of every rotate interval-t,nfcapdruns an expire cycle to delete files according to max lifetime and max filesize as defined bynfexpire(1)๐ฅ-xcommand โ okay so every time a-tinterval wraps up and the file rotate has finished doing its thing,nfcapdruns command. And the string you pass can have lil placeholders in it that get expanded before it runs, bestie:%fโ the file name of the new data file, including any sub hierarchy ๐%dโ the top flowdir. Full path of the new file is:%d/%f%tโ the time slot string in ISO format, e.g.201107110845%uโ the time slot string in UNIX time format%iโ the identification string, i.e. the ident string you supplied with-I
-XextensionList โ extensionList is a','separated list of extensions thatnfcapdshould store. The numbers correspond to the extension list innfxV3.h. By default extensions are added dynamically so it stores all the data the exporter sends. But if you give extensionList, only those elements matching the extension get processed and stored. Usually you don't need this option at all, unless you have specific requirements โจ-mmetricpath โ turns on the flow metric exporter ๐ Flow metric info gets sent to the UNIX socket metricpath at the rate you set with-i. This option may be used to export flow metric info to other systems such as InfluxDB or Prometheus. But real talk: the flow metric does not include the full record, only the flow statistics get sent. ๐-imetricrate โ sets the interval for the flow metric exporter. This interval can be different from the file rotation interval t, so it's independent from file rotation. Two separate clocks, no drama ๐ฆ-vlevel โ sets the verbose level. Accepted values are0to4. Default level is1with moderate information. Use-v 3to printf netflow records in raw format while collecting. Heads up though โ not all elements get printed. This option is for debugging purposes only, to verify if incoming netflow data is processed correctly ๐-Vโ prints thenfcapdversion and exits. Short and sweet, we love a quick exit โญ-hโ prints the help text on stdout with all the options and exits ๐ธ
โจ EXIT STATUS โจ
nfcapd returns 0 on success and 255 if initialization failed ๐ญ
So like, if you see 255, something went wrong before it even got going. Vibe check failed. ๐
๐ฆ SEE ALSO ๐ฆ
https://www.iana.org/assignments/ipfix/ipfix.xhtmlhttps://www.cisco.com/en/US/technologies/tk648/tk362/technologies_white_paper09186a00800a3db9.htmlnf:dump(1)โ wait, no, keeping it exact:nfdump(1),nfpcapd(1),sfcapd(1)
๐ BUGS ๐
No software without bugs! Please report any bugs back to me ๐๐ซถ
And that's the whole page, bestie โ it's giving source Debian, version $Mdocdate$, and it's dated NFCAPD(1). Go collect those flows, ily, bye ๐๐โจ
๐ฆ where this page comes from
- epel 10: nfdump 1.7.10-1.el10_3 ยท BSD-3-Clause AND GPL-2.0-or-later
- Copyright (c) 2023, Peter Haag
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms