prevent active log from being overwritten when agent starts (#11386)

This commit is contained in:
Luiz Aoqui
2021-10-26 20:57:07 -04:00
committed by GitHub
parent 1fbe88fbd6
commit 796a91b0be
6 changed files with 82 additions and 7 deletions

View File

@@ -0,0 +1,17 @@
//go:build dragonfly || linux || solaris
// +build dragonfly linux solaris
package agent
import (
"os"
"syscall"
"time"
)
func (l *logFile) createTime(stat os.FileInfo) time.Time {
stat_t := stat.Sys().(*syscall.Stat_t)
createTime := stat_t.Ctim
// Sec and Nsec are int32 in 32-bit architectures.
return time.Unix(int64(createTime.Sec), int64(createTime.Nsec)) //nolint:unconvert
}