support compression after rotation of logs (#19647)

This commit is contained in:
Harshavardhana
2024-05-01 15:38:07 -07:00
committed by GitHub
parent f3d61c51fc
commit 402a3ac719
2 changed files with 90 additions and 4 deletions

View File

@@ -205,6 +205,12 @@ var ServerFlags = []cli.Flag{
EnvVar: "MINIO_LOG_SIZE",
Hidden: true,
},
cli.BoolFlag{
Name: "log-compress",
Usage: "specify if we want the rotated logs to be gzip compressed or not",
EnvVar: "MINIO_LOG_COMPRESS",
Hidden: true,
},
}
var serverCmd = cli.Command{
@@ -682,6 +688,7 @@ func initializeLogRotate(ctx *cli.Context) (io.WriteCloser, error) {
output, err := logger.NewDir(logger.Options{
Directory: lgDirAbs,
MaximumFileSize: int64(lgSize),
Compress: ctx.Bool("log-compress"),
})
if err != nil {
return nil, err