Hello!
I use nfsen-1.3.8.
The problem: nfsen incorrectly deletes files with this pattern -
nfcapd.current.* - when "%sources" in nfsen.conf have "'port' => '0'" (for
example:
%sources=(
'test' => { 'IP' => '192.0.2.1', 'port' => '0', 'col' => '#000080', 'type'
=> 'netflow' },
);
For the above configuration nfsen must not start/stop the collector because the
last is managed outside nfsen. And when nfsen deletes nfcapd.current.* the
collector cannot save current netflow data because of deletion of the
appropriate file by nfsen.
I propose to not delete the collector's current stat file for the above
configuration. The working patch follows.
--- NfSen.pm.orig Sat Oct 7 08:32:43 2023
+++ NfSen.pm Fri Nov 24 20:16:03 2023
@@ -447,8 +447,10 @@
my @orphans = grep { -f "$channeldir/$_" &&
/$orphan_name\.\d+/ } readdir(DIR);
closedir DIR;
foreach my $file ( @orphans ) {
- syslog('err', "Clean orphan data file:
'$channeldir/$file'");
- unlink "$channeldir/$file";
+ if ( $NfConf::sources{$channel}{'port'}
!= 0 ) {
+ syslog('err', "Clean orphan
data file: '$channeldir/$file'");
+ unlink "$channeldir/$file";
+ }
}
}
}
--
Alexei Malinin
_______________________________________________
Nfsen-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/nfsen-discuss