1nfexpire(1) nfexpire(1)
2
3
4
6 nfexpire - data expiry program
7
9 nfexpire [options]
10
12 nfexpire is used to manage the expiration of old netflow data files,
13 created by nfcapd(1) or other data collectors such as sfcapd(1). Data
14 expiration is done either by nfcapd(1) in auto expiry mode, or by nfex‐
15 pire which can by run at any time or any desired time interval by cron.
16 nfexpire can also be safely run while nfcapd auto expires files, for
17 cleaning up full disks etc. nfexpire is sub directory hierarchy aware,
18 and handles any format automatically. For a fast and efficient expira‐
19 tion, nfexpire creates and maintains a stat file named .nfstat in the
20 data directory. Any directory supplied with the options below corre‐
21 sponds to the data directory supplied to nfcapd(1) using option -l.
22
23
25 -l directory
26 List current data statistics in directory datadir.
27
28 -r directory
29 Rescan the specified directory to update the statfile. To be used
30 only when explicit update is required. Usually nfexpire takes care
31 itself about rescanning, when needed.
32
33 -e datadir
34 Expire files in the specified directory. Expire limits are taken
35 from statfile ( see -u ) or from supplied options -s -t and -w. Com‐
36 mand line options overwrite stat file values, however the statfile
37 limits are not changed.
38
39 -s maxsize
40 Set size limit for the directory. The specified limit accepts values
41 such as 100M, 100MB 1G 1.5G etc. Accpeted size factors are K, KB, M,
42 MB, G, GB and T, TB. If no factor is supplied bytes (B) is assumed.
43 A value of 0 disables the max size limit.
44
45 -t maxlife_time
46 Sets the max life time for files in the directory. The supplied
47 maxlife_time accepts values such as 31d, 240H 1.5d etc. Accpeted
48 time scales are w (weeks) d (days) H (hours). A value of 0 disables
49 the max lifetime limit. If no scale is given, H (hours) are assumed.
50
51 -u datadir
52 Updates the max size and lifetime limits, specified by -s -t and -w
53 and stores them in the statfile as default values. A running
54 nfcapd(1) process doing auto expiry will take these new values
55 starting with the next expiry cycle. Running nfexpire next time
56 doing file expiration will take these new limits unless -s -t or -w
57 are specified.
58
59 -w watermark
60 Set the water mark in % for expiring data. If a limit is hit, files
61 get expired down to this level in % of that limit. If not set, the
62 default is 95%.
63
64 -h Print help text on stdout with all options and exit.
65
66 -p Directories specified by -e, -l and -r are interpreted as profile
67 directories. Only NfSen will need this option.
68
69 -Y Print result in parseable format. Only NfSen will need this option.
70
72 Returns
73 0 No error.
74 255 Initialization failed.
75 250 Internal error.
76
78 There are two ways to expire files: nfcapd in auto-expire mode ( option
79 -e ) and nfexpire running by hand or periodically as cron job. Both
80 ways synchronize access to the files, therefore both ways can be run in
81 parallel if required.
82
83 Expiring by nfcapd in auto-expire mode: option -e
84 If nfcapd is started with option -e, the auto-expire mode is enabled.
85 After each cycle ( typically 5min ) nfcapd expires files according to
86 the limits set with nfexpire using options -u -s -t and -w. If ini‐
87 tially no limits are set, no files get expired.
88
89 Expiring by nfexpire
90 nfexpire can be run at any time to expire files. It automatically syncs
91 up with the files created by nfcapd in the mean time since the last
92 expire run, if a nfcapd collector process is running for that directory
93 in question and expires the files according the limits set.
94
95 Limits
96 Files are expired according to two limits: maximum disk space used by
97 all files in the directory and maximum lifetime of data files, whatever
98 limit is reached first. If one of the limit is hit the expire process
99 will delete files down to the watermark of that limit.
100
102 nfcapd(1)
103
105 2009-09-09 nfexpire(1)