1sfcapd(1)                                                            sfcapd(1)
2
3
4

NAME

6       sfcapd - sflow capture daemon
7

SYNOPSIS

9       sfcapd [options]
10

DESCRIPTION

12       sfcapd  is the sflow capture daemon of the nfdump tools. It reads sflow
13       data from the network and stores it into nfcapd compatible files.   The
14       output file is automatically rotated and renamed every n minutes - typ‐
15       ically 5 min - according the timestamp  YYYYMMddhhmm  of  the  interval
16       e.g.  nfcapd.201907110845  contains  the data from July 11th 2019 08:45
17       onward. sfcapd supports sFlow version 4 and 5 datagrams.  If  the  time
18       interval  is  smaller  then  60s,  the  naming  extends to seconds e.g.
19       nfcapd.20190711084510.
20
21       Sflow is an industry standard developed by InMon Corporation.  For more
22       information see http://sflow.org.
23

OPTIONS

25       -p portnum
26          Specifies the port number to listen. Default port is 6343
27
28       -b bindhost
29          Specifies  the hostname/IPv4/IPv6 address to bind for listening. Can
30          be an IP address or a hostname, resolving to an IP address  attached
31          to  an  interface.  Defaults to any available IPv4 interface, if not
32          specified.
33
34       -4 Forces sfcapd to listen on IPv4 addresses only. Can be used together
35          with -b if a hostname has an IPv4 and IPv6 address record. Depending
36          on the socket implementation -6 also accepts IPv4 data.
37
38       -6 Forces sfcapd to listen on IPv6 addresses only. Can be used together
39          with -b if a hostname has an IPv4 and IPv6 address record.
40
41       -j MulticastGroup
42          Join the specified IPv6 or IPv6 multicast group for listening.
43
44       -R host[/port}
45          Enable  packet  repeater.  Send all incoming packets to another host
46          and port.  host is either a valid IPv4/IPv6 address, or a valid sim‐
47          bolic  hostname,  which resolves to a IPv6 or IPv4 address. port may
48          be omitted and  defaults  to  port  6343.  Note:  Due  to  IPv4/IPv6
49          accepted  addresses  the port separator is '/'. Up to 8 repeaters my
50          be defined.
51
52       -I IdentString ( capital letter i )
53          Specifies an ident string, which describes the source e.g. the  name
54          of  the  router. This string is put into the stat record to identify
55          the source. Default is 'none'. This is for compatibility with nfdump
56          1.5.x and used to specify a single sflow source. See -n
57
58       -l base_directory ( letter ell )
59          Specifies  the  base  directory to store the output files.  If a sub
60          hierarchy is specified with -S the final directory  is  concatenated
61          to  base_directory/sub_hierarchy.  This  is  for  compatibility with
62          nfdump 1.5.x and used to specify a single sflow source. See -n
63
64       -n <Ident,IP,base_directory>
65          Configures an sflow source named Ident and identified by  source  IP
66          address  IP.   The  base directory for the flow files is base_direc‐
67          tory. If a sub hierarchy is specified with -S the final directory is
68          concatenated   to   base_directory/sub_hierarchy.  Multiple  netflow
69          sources can be specified. All data is sent to the same  port  speci‐
70          fied  by  -p.   Note: You must not mix -n option with -I and -l. Use
71          either syntax.
72
73       -f <pcap_file>
74          Read sflow packets from a give pcap_file  instead  of  the  network.
75          This  requires  sfcapd  to  be  compiled with the pcap option and is
76          intended for debugging only.
77
78       -S <num>
79          Allows to specify an additional directory sub hierarchy to store the
80          data  files.  The  default  is  0, no sub hierarchy, which means the
81          files go directly in the base directory  (-l).  The  base  directory
82          (-l) is concatenated with the specified sub hierarchy format to form
83          the final data directory.  The following hierarchies are defined:
84            0 default     no hierarchy levels
85            1 %Y/%m/%d    year/month/day
86            2 %Y/%m/%d/%H year/month/day/hour
87            3 %Y/%W/%u    year/week_of_year/day_of_week
88            4 %Y/%W/%u/%H year/week_of_year/day_of_week/hour
89            5 %Y/%W/%u    year/week_of_year/day_of_week
90            6 %Y/%W/%u/%H year/week_of_year/day_of_week/hour
91            7 %Y/%j       year/day-of-year
92            8 %Y/%j/%H    year/day-of-year/hour
93            9 %Y-%m-%d    year-month-day
94           10 %Y-%m-%d/%H year-month-day/hour
95
96       -T <extension list>
97          Specifies the list of extensions, to be stored  in  the  flow  file.
98          Regardless of the extension list, the following sflow data is stored
99          per record: first, last, fwd status, tcp flags, proto, (src)tos, src
100          port,  dst  port, src ipaddr, dst ipaddr, in(packets), in(bytes). In
101          addition sfcapd recognises the extensions as described below.
102
103          Extensions:
104           sflow extensions:
105            1 input/output interface SNMP numbers.
106            2 src/dst AS numbers.
107            3 src/dst mask, (dst)TOS, direction,
108            4 Next hop IP addr
109            5 BGP next hop IP addr
110            6 src/dst vlan id labels
111           10 in_src/out_dst MAC address
112           By default extension 1 and 2 are selected, which provides  compati‐
113           bility   with   earlier   nfdump   version.    Extensions   can  be
114           added/deleted by specifying a ',' separated list of extension  ids.
115           Each id may be prepended by an optional sign +/- to add or remove a
116           given id from the extension list. The string 'all' means all exten‐
117           sions. Extensions 7-9 are not available for sfcapd.
118           Examples:
119           -T all       Enables all possible extensions.
120           -T +3,+4     Adds extensions 3 and 4 to the defaults 1 and 2.
121           -T all,-5,-6 Set all extensions but 5 and 6
122           -T -1,4      Removes default extension 1 and adds extension 4
123           Note:  Extensions  are  shared  with  the netflow collector nfcapd.
124           Sflow as well as netflow data is stored in the same type of  exten‐
125           sions.
126
127       -t interval
128          Specifies  the time interval in seconds to rotate files. The default
129          value is 300s ( 5min ). The smallest interval can be set to 2s.
130
131       -w Align file rotation with next n minute ( specified by -t ) interval.
132          Example:  If interval is 5 min, sync at 0,5,10... wall clock minutes
133          Default: no alignment.
134
135       -x cmd
136          Run command cmd at the end  of  every  interval,  when  a  new  file
137          becomes available. The following command expansion is available:
138           %f   Replaced by the file name e.g nfcapd.200407110845 inluding any
139                sub hierarchy. ( 2004/07/11/nfcapd.200407110845 )
140           %d   Replaced by the directory where the file is located.
141           %t   Replaced by the time ISO format e.g. 200407110845.
142           %u   Replaced by the UNIX time format.
143           %i   Replaced ident string given by -I
144
145       -e Auto  expire files at every cycle. max lifetime and max filesize are
146          defined using nfexpire(1)
147
148       -P pidfile
149          Specify name of pidfile. Default is no pidfile.
150
151       -D Daemon mode: fork to background and detach  from  terminal.   Nfcapd
152          terminates on signal TERM, INT and HUP.
153
154       -u userid
155          Change  to the user userid as soon as possible. Only root is allowed
156          to use this option.
157
158       -g groupid
159          Change to the group groupid  as  soon  as  possible.  Only  root  is
160          allowed use this option.
161
162       -B bufflen
163          Specifies  the  socket input buffer length in bytes. For high volume
164          traffic ( near GB traffic ) it is recommended to set this  value  as
165          high  as  possible  ( typically > 100k ), otherwise you risk to lose
166          packets. The default is OS ( and kernel )  dependent.
167
168       -E Print data records in nfdump raw format to stdout.  This  option  is
169          for  debugging  purpose only, to see how incoming sflow data is pro‐
170          cessed and stored.
171
172       -j Compress flows. Use bz2 compression in output file. Note: not recom‐
173          mended while collecting
174
175       -z Compress flows. Use fast LZO1X-1 compression in output file.
176
177       -V Print sfcapd version and exit.
178
179       -h Print help text to stdout with all options and exit.
180

RETURN VALUE

182       Returns 0 on success, or 255 if initialization failed.
183

LOGGING

185       sfcapd logs to syslog with SYSLOG_FACILITY LOG_DAEMON For normal opera‐
186       tion level 'warning' should be fine.  More information is  reported  at
187       level 'info' and 'debug'.
188
189       A  small  statistic  about  the  collected flows, as well as errors are
190       reported at the end of every interval to syslog with level 'info'.
191

EXAMPLES

193       Compatible with old sfcapd 1.5.x:
194              sfcapd -w -D -l /data/spool/router1 -p 6343 -B 128000 -I router1
195              -x '/path/some_app -r %d/%f'  -P /var/run/sfcapd/sfcapd.router1
196
197       Selectively enabled sender:
198              sfcapd  -Tall  -w -D -n router1,192.168.1.10,/data/spool/router1
199              -p 6343 -B 128000 -P /var/run/sfcapd/sfcapd.router1
200

NOTES

202       sfcapd automatically scales the packets and bytes  according  the  sam‐
203       pling rate.
204
205       Even  with  sflow version 4 and 5 support, not all available sflow ele‐
206       ments are stored in the data files. As of this version, sfcpad supports
207       the  the  same  shared  fields as extensions, as it's netflow companion
208       nfcapd for netflow version v9. See nfcapd(1). More fields will be  sup‐
209       ported in future.
210
211       The  format  of  the  data  files is version independent and compatible
212       nfcapd collected data.
213
214       Socket buffer: Setting the socket  buffer  size  is  system  dependent.
215       When  starting  up,  sfcapd  returns the number of bytes the buffer was
216       actually set. This is done by reading back the buffer size and may dif‐
217       fer from what you requested.
218

SEE ALSO

220       nfcapd(1), nfdump(1), nfprofile(1), nfreplay(1)
221
222
223
224                                  2009-09-09                         sfcapd(1)
Impressum