mirror of
https://github.com/Security-Onion-Solutions/securityonion.git
synced 2025-12-23 09:23:13 +01:00
Changes for LOG_SIZE_LIMIT
This commit is contained in:
@@ -15,10 +15,10 @@
|
|||||||
# Elastic License 2.0.
|
# Elastic License 2.0.
|
||||||
|
|
||||||
LOG="/opt/so/log/curator/so-curator-cluster-delete.log"
|
LOG="/opt/so/log/curator/so-curator-cluster-delete.log"
|
||||||
|
LOG_SIZE_LIMIT=$(/usr/sbin/so-elasticsearch-cluster-space-total {{ RETENTION.retention_pct}})
|
||||||
|
|
||||||
overlimit() {
|
overlimit() {
|
||||||
|
[[ $(/usr/sbin/so-elasticsearch-cluster-space-used) -gt "${LOG_SIZE_LIMIT}" ]]
|
||||||
[[ $(/usr/sbin/so-elasticsearch-cluster-space-used) -gt "/usr/sbin/so-elasticsearch-cluster-space-total{{ RETENTION.retention_pct}}" ]]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
closedindices() {
|
closedindices() {
|
||||||
@@ -41,7 +41,7 @@ closedindices() {
|
|||||||
# This should not be a write index, so we should be allowed to delete it
|
# This should not be a write index, so we should be allowed to delete it
|
||||||
/usr/sbin/so-elasticsearch-query ${CLOSED_INDEX} -XDELETE
|
/usr/sbin/so-elasticsearch-query ${CLOSED_INDEX} -XDELETE
|
||||||
# Finally, write a log entry that says we deleted it.
|
# Finally, write a log entry that says we deleted it.
|
||||||
echo "$(date) - Used disk space exceeds LOG_SIZE_LIMIT ({{LOG_SIZE_LIMIT}} GB) - Index ${CLOSED_INDEX} deleted ..." >> ${LOG}
|
echo "$(date) - Used disk space exceeds LOG_SIZE_LIMIT (${LOG_SIZE_LIMIT} GB) - Index ${CLOSED_INDEX} deleted ..." >> ${LOG}
|
||||||
fi
|
fi
|
||||||
if ! overlimit; then
|
if ! overlimit; then
|
||||||
exit
|
exit
|
||||||
@@ -69,7 +69,7 @@ while overlimit; do
|
|||||||
# This should not be a write index, so we should be allowed to delete it
|
# This should not be a write index, so we should be allowed to delete it
|
||||||
/usr/sbin/so-elasticsearch-query ${OPEN_INDEX} -XDELETE
|
/usr/sbin/so-elasticsearch-query ${OPEN_INDEX} -XDELETE
|
||||||
# Finally, write a log entry that says we deleted it.
|
# Finally, write a log entry that says we deleted it.
|
||||||
echo "$(date) - Used disk space exceeds LOG_SIZE_LIMIT ({{LOG_SIZE_LIMIT}} GB) - Index ${OPEN_INDEX} deleted ..." >> ${LOG}
|
echo "$(date) - Used disk space exceeds LOG_SIZE_LIMIT (${LOG_SIZE_LIMIT} GB) - Index ${OPEN_INDEX} deleted ..." >> ${LOG}
|
||||||
fi
|
fi
|
||||||
if ! overlimit; then
|
if ! overlimit; then
|
||||||
exit
|
exit
|
||||||
|
|||||||
Reference in New Issue
Block a user