SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.
Go blob-storagecloud-drivedistributed-file-systemdistributed-storageerasure-codingfusehadoop-hdfshdfskuberneteslancelancedbobject-storageposixs3s3-storageseaweedfstiered-file-systemvector-search
glog: add --log_max_size_mb and --log_max_files runtime flags (#8684)
JARDEL ALVES98f301e30b24
diff --git a/weed/glog/glog_file.go b/weed/glog/glog_file.goindex eef89802a3..f91acf82a2 100644--- a/weed/glog/glog_file.go+++ b/weed/glog/glog_file.go@@ -33,7 +33,11 @@ import ()// MaxSize is the maximum size of a log file in bytes.+// It is initialized from the --log_max_size_mb flag when the first log file is created.var MaxSize uint64 = 1024 * 1024 * 1800++// MaxFileCount is the maximum number of log files retained per severity level.+// It is initialized from the --log_max_files flag when the first log file is created.var MaxFileCount = 5// logDirs lists the candidate directories for new log files.@@ -43,7 +47,25 @@ var logDirs []string// See createLogDirs for the full list of possible destinations.var logDir = flag.String("logdir", "", "If non-empty, write log files in this directory")+// logMaxSizeMB controls the maximum size of each log file in megabytes.+// When a log file reaches this size it is closed and a new file is created.+// Defaults to 1800 MB. Set to 0 to use the compiled-in default.+var logMaxSizeMB = flag.Uint64("log_max_size_mb", 1800, "Maximum size in megabytes of each log file before it is rotated (0 = use default of 1800 MB)")++// logMaxFiles controls how many log files are kept per severity level.+// Older files are deleted when the limit is exceeded.+// Defaults to 5.+var logMaxFiles = flag.Int("log_max_files", 5, "Maximum number of log files to keep per severity level before older ones are deleted (0 = use default of 5)")+func createLogDirs() {+ // Apply flag values now that flags have been parsed.+ if *logMaxSizeMB > 0 {+ MaxSize = *logMaxSizeMB * 1024 * 1024+ }+ if *logMaxFiles > 0 {+ MaxFileCount = *logMaxFiles+ }+if *logDir != "" {logDirs = append(logDirs, *logDir)} else {