diff options
author | Ermal <eri@pfsense.org> | 2014-04-29 08:50:38 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2014-04-29 08:50:38 +0000 |
commit | 1641fd6dd0133119529be2b1ac57fcc605a0a976 (patch) | |
tree | 84be8e92aca33e4d909384f2d04262379ba27fb8 /config/suricata/suricata_check_cron_misc.inc | |
parent | d298aee67a45d08a93831a2b6f272165ff2f89e6 (diff) | |
parent | 06cf384a6603bc771dd91773b0d1f4347b47904b (diff) | |
download | pfsense-packages-1641fd6dd0133119529be2b1ac57fcc605a0a976.tar.gz pfsense-packages-1641fd6dd0133119529be2b1ac57fcc605a0a976.tar.bz2 pfsense-packages-1641fd6dd0133119529be2b1ac57fcc605a0a976.zip |
Merge pull request #652 from bmeeks8/suricata-1.0
Diffstat (limited to 'config/suricata/suricata_check_cron_misc.inc')
-rw-r--r-- | config/suricata/suricata_check_cron_misc.inc | 32 |
1 files changed, 22 insertions, 10 deletions
diff --git a/config/suricata/suricata_check_cron_misc.inc b/config/suricata/suricata_check_cron_misc.inc index b9ba3fb7..0a3bf113 100644 --- a/config/suricata/suricata_check_cron_misc.inc +++ b/config/suricata/suricata_check_cron_misc.inc @@ -173,19 +173,31 @@ if ($config['installedpackages']['suricata']['config'][0]['enable_log_mgmt'] == $suricata_log_dir = SURICATALOGDIR . "suricata_{$if_real}{$value['uuid']}"; foreach ($logs as $k => $p) suricata_check_rotate_log("{$suricata_log_dir}/{$k}", $p['limit']*1024, $p['retention']); - } - // Prune any aged-out Barnyard2 archived logs if any exist - if (is_dir("{$suricata_log_dir}/barnyard2/archive") && - $config['installedpackages']['suricata']['config'][0]['u2_archive_log_retention'] > 0) { - $now = time(); - $files = glob("{$suricata_log_dir}/barnyard2/archive/unified2.alert.*"); - foreach ($files as $f) { - if (($now - filemtime($f)) > ($config['installedpackages']['suricata']['config'][0]['u2_archive_log_retention'] * 3600)) - unlink_if_exists($f); + // Prune any aged-out Barnyard2 archived logs if any exist + if (is_dir("{$suricata_log_dir}/barnyard2/archive") && + $config['installedpackages']['suricata']['config'][0]['u2_archive_log_retention'] > 0) { + $now = time(); + $files = glob("{$suricata_log_dir}/barnyard2/archive/unified2.alert.*"); + foreach ($files as $f) { + if (($now - filemtime($f)) > ($config['installedpackages']['suricata']['config'][0]['u2_archive_log_retention'] * 3600)) + unlink_if_exists($f); + } + } + unset($files); + + // Prune aged-out File Store files if any exist + if (is_dir("{$suricata_log_dir}/files") && + $config['installedpackages']['suricata']['config'][0]['file_store_retention'] > 0) { + $now = time(); + $files = glob("{$suricata_log_dir}/files/file.*"); + foreach ($files as $f) { + if (($now - filemtime($f)) > ($config['installedpackages']['suricata']['config'][0]['file_store_retention'] * 3600)) + unlink_if_exists($f); + } } + unset($files); } - unset($files); } // Check the overall log directory limit (if enabled) and prune if necessary |