From 81466eef8167d80b63e9f579a6fc1e43d34c906c Mon Sep 17 00:00:00 2001 From: Christine Dodrill Date: Thu, 4 Feb 2021 12:20:17 -0500 Subject: [PATCH] Add an environment variable to enable customizing the log target (#1243) Signed-off-by: Christine Dodrill --- logpolicy/logpolicy.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/logpolicy/logpolicy.go b/logpolicy/logpolicy.go index 3a07479a4..4f6ab774c 100644 --- a/logpolicy/logpolicy.go +++ b/logpolicy/logpolicy.go @@ -17,6 +17,7 @@ import ( "log" "net" "net/http" + "net/url" "os" "os/exec" "path/filepath" @@ -387,6 +388,13 @@ func New(collection string) *Policy { HTTPC: &http.Client{Transport: newLogtailTransport(logtail.DefaultHost)}, } + if val, ok := os.LookupEnv("TAILSCALE_LOG_TARGET"); ok { + log.Println("You have enabled a non-default log target. Doing without being told to by Tailscale staff or your network administrator will make getting support difficult.") + c.BaseURL = val + u, _ := url.Parse(val) + c.HTTPC = &http.Client{Transport: newLogtailTransport(u.Host)} + } + filchBuf, filchErr := filch.New(filepath.Join(dir, cmdName), filch.Options{}) if filchBuf != nil { c.Buffer = filchBuf