mirror of
https://github.com/netbirdio/netbird.git
synced 2026-09-24 23:59:08 +02:00
Add tests for rotated files in bundle
This commit is contained in:
@@ -1048,23 +1048,13 @@ func (g *BundleGenerator) addRotatedLogFiles(logDir string) {
|
||||
}
|
||||
|
||||
// This regex will match both logs rotated by us and logrotate on linux
|
||||
pattern := filepath.Join(logDir, "client*.log*.gz")
|
||||
pattern := filepath.Join(logDir, "client*.log.*")
|
||||
files, err := filepath.Glob(pattern)
|
||||
if err != nil {
|
||||
log.Warnf("failed to glob rotated logs: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
// This regex will match plain logs rotated by logrotate on linux.
|
||||
// We assume that logrotate is configured with nocompress or delaycompress.
|
||||
pattern = filepath.Join(logDir, "client*.log.*")
|
||||
uncompressedFiles, err := filepath.Glob(pattern)
|
||||
if err != nil {
|
||||
log.Warnf("failed to glob rotated logs: %v", err)
|
||||
return
|
||||
}
|
||||
files = uncompressedFiles
|
||||
|
||||
if len(files) == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user