logpolicy: on Windows, use tailscale-ipn log name if it already existed
For the migration to tailscaled.exe on Windows, don't create a new logid
if one existed under the old filename.
Updates
@@ -339,6 +339,18 @@ func New(collection string) *Policy {
tryFixLogStateLocation(dir, cmdName)
cfgPath := filepath.Join(dir, fmt.Sprintf("%s.log.conf", cmdName))
+
+ // The Windows service previously ran as tailscale-ipn.exe, so
+ // let's keep using that log base name if it exists.
+ if runtime.GOOS == "windows" && cmdName == "tailscaled" {
+ const oldCmdName = "tailscale-ipn"
+ oldPath := filepath.Join(dir, oldCmdName+".log.conf")
+ if fi, err := os.Stat(oldPath); err == nil && fi.Mode().IsRegular() {
+ cfgPath = oldPath
+ cmdName = oldCmdName
+ }
+ }
+
var oldc *Config
data, err := ioutil.ReadFile(cfgPath)
if err != nil {
