From 69031ab6b2f510194b47b817e714893c6c5de342 Mon Sep 17 00:00:00 2001 From: m0duspwnens Date: Fri, 10 Apr 2020 16:15:43 -0400 Subject: [PATCH] change log_size_limit logic - https://github.com/Security-Onion-Solutions/securityonion-saltstack/issues/551 --- setup/so-functions | 28 +++++++++++++++++++--------- setup/so-whiptail | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/setup/so-functions b/setup/so-functions index 95dee4d33..559a8ab66 100755 --- a/setup/so-functions +++ b/setup/so-functions @@ -720,15 +720,25 @@ get_filesystem_nsm(){ get_log_size_limit() { - DISK_DIR="/" - if [ -d /nsm ]; then - DISK_DIR="/nsm" - fi - DISK_SIZE_K=`df $DISK_DIR |grep -v "^Filesystem" | awk '{print $2}'` - PERCENTAGE=85 - DISK_SIZE=DISK_SIZE_K*1000 - PERCENTAGE_DISK_SPACE=`echo $(($DISK_SIZE*$PERCENTAGE/100))` - LOG_SIZE_LIMIT=$(($PERCENTAGE_DISK_SPACE/1000000000)) + case $INSTALLTYPE in + EVAL | HEAVYNODE) + PERCENTAGE=50 + ;; + *) + PERCENTAGE=80 + ;; + esac + + DISK_DIR="/" + + if [ -d /nsm ]; then + DISK_DIR="/nsm" + fi + + DISK_SIZE_K=`df $DISK_DIR |grep -v "^Filesystem" | awk '{print $2}'` + DISK_SIZE=DISK_SIZE_K*1000 + PERCENTAGE_DISK_SPACE=`echo $(($DISK_SIZE*$PERCENTAGE/100))` + LOG_SIZE_LIMIT=$(($PERCENTAGE_DISK_SPACE/1000000000)) } diff --git a/setup/so-whiptail b/setup/so-whiptail index 16c1f757b..4b51b3bd7 100755 --- a/setup/so-whiptail +++ b/setup/so-whiptail @@ -309,7 +309,7 @@ whiptail_log_size_limit() { LOG_SIZE_LIMIT=$(whiptail --title "Security Onion Setup" --inputbox \ "Please specify the amount of disk space (in GB) you would like to allocate for Elasticsearch data storage. \ - By default, this is set to 85% of the disk space allotted for /nsm." 10 75 $LOG_SIZE_LIMIT 3>&1 1>&2 2>&3) + By default, this is set to 80% of the disk space allotted for /nsm." 10 75 $LOG_SIZE_LIMIT 3>&1 1>&2 2>&3) local exitstatus=$? whiptail_check_exitstatus $exitstatus