JBAS-2095 Syslog delete all files older than 2 years
authorBill Erickson <berickxx@gmail.com>
Mon, 28 Jan 2019 17:38:22 +0000 (12:38 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
In other words, only retain the activity and apache access log files for
2 years total.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/admin-scripts/manage-log-files.sh

index 93da78d..ee02800 100755 (executable)
@@ -25,7 +25,10 @@ set -eu
 # Example: a compress value of "3" means compress files 
 # last modified more than 3 days ago.
 COMPRESS_AGE=3
+# delete certain files that reach this age.
 DELETE_AGE=365
+# delete all files this old regardless of file type
+DELETE_ALL_AGE=730
 
 function usage {
     cat <<USAGE
@@ -42,6 +45,11 @@ while getopts "d:c:h" opt; do
     esac
 done;
 
+# Delete all Evergreen log files that are older than DELETE_ALL_AGE,
+# regardless of the type of file.
+
+/usr/bin/find /var/log/evergreen -type f -mtime +$DELETE_ALL_AGE -delete
+
 # Delete all Evergreen log files that are older than DELETE_AGE
 # days, except for the Apache access log and Evergreen activity log.