From 7fd03ad4b433530d0c15cafa2c9d432a5bc71eb8 Mon Sep 17 00:00:00 2001 From: Denton Gentry Date: Sat, 23 Jul 2022 18:41:49 -0700 Subject: [PATCH] logpolicy: put QNAP logs buffer in /tmp Ongoing log writing keeps the spinning disks from hibernating. Extends earlier implementation for Synology to also handle QNAP. Signed-off-by: Denton Gentry --- logpolicy/logpolicy.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/logpolicy/logpolicy.go b/logpolicy/logpolicy.go index 952c3dc79..8ba2a2e62 100644 --- a/logpolicy/logpolicy.go +++ b/logpolicy/logpolicy.go @@ -551,12 +551,12 @@ func New(collection string) *Policy { } filchPrefix := filepath.Join(dir, cmdName) - // Synology disks cannot hibernate if we're writing logs to them all the time. + // NAS disks cannot hibernate if we're writing logs to them all the time. // https://github.com/tailscale/tailscale/issues/3551 - if runtime.GOOS == "linux" && distro.Get() == distro.Synology { - synologyTmpfsLogs := "/tmp/tailscale-logs" - if err := os.MkdirAll(synologyTmpfsLogs, 0755); err == nil { - filchPrefix = filepath.Join(synologyTmpfsLogs, cmdName) + if runtime.GOOS == "linux" && (distro.Get() == distro.Synology || distro.Get() == distro.QNAP) { + tmpfsLogs := "/tmp/tailscale-logs" + if err := os.MkdirAll(tmpfsLogs, 0755); err == nil { + filchPrefix = filepath.Join(tmpfsLogs, cmdName) filchOptions.MaxFileSize = 1 << 20 } else { // not a fatal error, we can leave the log files on the spinning disk