func copyLogFile()

in agent/logging/agent_logging.go [72:95]


func copyLogFile(src, dst string) (int64, error) {
	sourceFileStat, err := os.Stat(src)
	if err != nil {
		return -1, err
	}

	if !sourceFileStat.Mode().IsRegular() {
		return -1, fmt.Errorf("%s is not a regular file", src)
	}

	source, err := os.Open(src)
	if err != nil {
		return -1, err
	}
	defer source.Close()

	destination, err := os.Create(dst)
	if err != nil {
		return -1, err
	}

	defer destination.Close()
	return io.Copy(destination, source)
}