swarm icon indicating copy to clipboard operation
swarm copied to clipboard

Flag for swapRotatingFileHandler filesize

Open santicomp2014 opened this issue 5 years ago • 0 comments

Currently, the log level/logpath for swap logs are defined in the cli.

  • swap-audit-loglevel
  • swap-audit-logpath

Another flag should be added specifically for the purpose of defining max split size. Once this limit is reached a new log file is created, to avoid massive text files.

swap/log.go

const fileSizeLimit = 262144 // max bytes limit for splitting file in parts

// swapRotatingFileHandler returns a RotatingFileHandler this will split the logs into multiple files.
// the files are split based on the limit parameter expressed in bytes
...
func swapRotatingFileHandler(logdir string) (log.Handler, error) {
	return log.RotatingFileHandler(
		logdir,
		fileSizeLimit,
		log.JSONFormatOrderedEx(false, true),
	)
}

santicomp2014 avatar Mar 06 '20 15:03 santicomp2014