Project

General

Profile

Actions

Bug #7756

closed

suricata suricata_check_dir_size_limit() needs to be improved

Added by Orion Poplawski over 6 years ago. Updated over 6 years ago.

Status:
Resolved
Priority:
Normal
Assignee:
-
Category:
Suricata
Target version:
-
Start date:
08/04/2017
Due date:
% Done:

0%

Estimated time:
Plus Target Version:
Affected Version:
2.3.4_1
Affected Plus Version:
Affected Architecture:

Description

The cleanup process in suricata_check_dir_size_limit() is not very optimal. There are a couple issues:

- It immediately truncates active logs - including alerts, and cleans up as much as it can rather than as little as it needs to. It should start by first removing some amount of rotated logs, and stop when enough space is cleared.
- It assumes rotated logs are of the form "*.log.*" - this isn't true for eve.json - and is generally the largest culprit
- log.pcap.* is processed there and in suricata_post_delete_logs()

The attached patch attempts to fix this. It first cleans up rotated logs, then stops if it has cleaned up enough. It then goes on to clean more in stages.


Files

suricata_check_cron_misc.inc.patch (5.01 KB) suricata_check_cron_misc.inc.patch Initial patch Orion Poplawski, 08/04/2017 11:16 AM
Actions #1

Updated by Bill Meeks over 6 years ago

I'm the volunteer package maintainer for Suricata on pfSense. Thank you for providing a patch to go along with your bug report. The best way to submit your patch is to sign a Contributor License Agreement (CLA) on the pfSense web site (you can do it all electronically), and then submit your patch as a pull request here: https://github.com/pfsense/FreeBSD-ports. This is assuming you have a Github account. If not, or if you don't wish to bother with the CLA, I will include your patch in the next update I submit for Suricata. It's been a very long time since I've looked at the log cleanup code, and some changes were overdue.

Bill

Actions #3

Updated by Bill Meeks over 6 years ago

Thanks! Another user had also submitted a fix for the EVE JSON log rotation issue. I asked him about incorporating your patch into his before I saw your recent reply, but if you have submitted yours already via Github, that's great.

Bill

Actions #4

Updated by Bill Meeks over 6 years ago

This bug is fixed in GUI package version 4.0.0 using the code submitted by the OP.

Actions #5

Updated by Kill Bill over 6 years ago

Fixed.

Actions #6

Updated by Jim Pingle over 6 years ago

  • Status changed from New to Resolved
Actions

Also available in: Atom PDF