Merge branch 'ent-13046-Implementar-que-padora-db-borre-los-ficheros-current-basura-del-netflow' into 'develop'

delete oldest netflow current files

See merge request artica/pandorafms!7035
This commit is contained in:
Juan Antonio Loarte 2024-04-01 13:46:49 +00:00
commit 25ba53cf89
1 changed files with 7 additions and 1 deletions

View File

@ -381,6 +381,13 @@ sub pandora_purgedb ($$$) {
log_message ('PURGE', 'netflow_max_lifetime is set to 0. Old netflow data will not be deleted.');
}
# Delete old nfcapd .current files
log_message ('PURGE', 'Deleting old nfcapd .current files.');
my $network_path = pandora_get_tconfig_token($dbh, 'general_network_path', '/var/spool/pandora/data_in/');
my $name_dir = pandora_get_tconfig_token($dbh, 'netflow_name_dir', 'netflow');
my $command = 'ls -t ' . $network_path . '/' . $name_dir . '/*.current* | tail -n +2 | xargs rm -f';
system($command) == 0 or log_message('!', $!);
# Delete old sflow data
if (!defined($conf->{'_sflow_max_lifetime'})){
log_message ('PURGE', 'sflow_max_lifetime is not defined. Old sflow data will not be deleted.');
@ -1492,5 +1499,4 @@ if (defined($history_dbh)) {
# Cleanup and exit
db_disconnect ($history_dbh) if defined ($history_dbh);
db_disconnect ($dbh);
exit 0;