Decimal support for events.stream.output.rotate.when

This commit is contained in:
Giuseppe 2018-10-28 22:41:31 +01:00
commit 251dbb3ef2
4 changed files with 28 additions and 6 deletions

View file

@ -167,7 +167,7 @@ func (s *EventsStream) doRotation() {
doRotate := false
if info, err := s.output.Stat(); err == nil {
if s.rotation.How == "size" {
doRotate = info.Size() >= int64(s.rotation.Period)
doRotate = float64(info.Size()) >= float64(s.rotation.Period*1024*1024)
} else if s.rotation.How == "time" {
doRotate = info.ModTime().Unix()%int64(s.rotation.Period) == 0
}