added simple log rotator

This commit is contained in:
2026-03-24 10:51:00 +02:00
parent b443292720
commit 6f66d14329
7 changed files with 44 additions and 10 deletions

View File

@@ -35,6 +35,8 @@ type Config struct {
LogPath string `json:"logfile" yaml:"logfile"`
RunPath string `json:"runfile" yaml:"runfile"`
AsDaemon bool `json:"asDaemon" yaml:"asDaemon"`
LogLimit int64 `json:"logLimit" yaml:logLimit`
}
func NewConfig() (*Config, error) {
@@ -43,6 +45,7 @@ func NewConfig() (*Config, error) {
Port: client.DefaultServicePort,
},
AsDaemon: false,
LogLimit: 1024 * 1024 * 10, // 10 Mb
}
hostname, err := os.Hostname()
if err != nil {

10
app/config/variant.go Normal file
View File

@@ -0,0 +1,10 @@
package config
const (
confdirPath = "/home/ziggi/Projects/sys2agent/etc/minilb"
rundirPath = "/home/ziggi/Projects/sys2agent/tmp/run"
logdirPath = "/home/ziggi/Projects/sys2agent/tmp/log"
datadirPath = "/home/ziggi/Projects/sys2agent/tmp/data"
packageVersion = "0.0.1"
)