Skip to content
This repository has been archived by the owner on Apr 19, 2021. It is now read-only.

Commit

Permalink
NSM: sensor cleanup fails when there are a high number of pcaps #1234
Browse files Browse the repository at this point in the history
  • Loading branch information
dougburks committed Apr 11, 2018
1 parent 69943a4 commit b817151
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions usr/lib/nsmnow/lib-nsm-sensor-utils
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,8 @@ sensor_cleandisk()
# there are no pcaps from previous days, so look for pcaps from today that we can delete
CUR_USAGE=$(df -P $SENSOR_DIR | grep -v -i filesystem | awk '{print $5}' | tr -d %)
# keep looping until EITHER disk usage is no longer critical OR we're out of pcaps to delete
while [ "$CUR_USAGE" -gt "$CRIT_DISK_USAGE" ] && [ `ls $SENSOR/dailylogs/$TODAY/snort.log.* | wc -l` -gt 1 ]; do
PCAP=`ls $SENSOR/dailylogs/$TODAY/snort.log.* |head -1`
while [ "$CUR_USAGE" -gt "$CRIT_DISK_USAGE" ] && [ `find $SENSOR/dailylogs/$TODAY/ -type f -name 'snort.log.*' | wc -l` -gt 1 ]; do
PCAP=`find $SENSOR/dailylogs/$TODAY/ -type f -name 'snort.log.*' | sort | head -1`
echo_msg 1 "removing pcap from today's directory: $PCAP"
rm -f "$PCAP"
CUR_USAGE=$(df -P $SENSOR_DIR | grep -v -i filesystem | awk '{print $5}' | tr -d %)
Expand Down

0 comments on commit b817151

Please sign in to comment.