Compare commits

...

7 Commits

Author SHA1 Message Date
Christine Dodrill
85605128fb ipn: use LogServer pref
Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-02-03 15:48:34 -05:00
Christine Dodrill
15784dd123 ipn: cloner
Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-02-03 15:48:34 -05:00
Christine Dodrill
4cc84f62c6 ipn: add LoginServer pref for windows
Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-02-03 15:48:34 -05:00
Christine Dodrill
a6a834b5fe logpolicy: shorten envvar name
Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-02-03 15:10:16 -05:00
Christine Dodrill
8ec50db8ef logtail: remove this debugging printf
Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-02-03 12:26:23 -05:00
Christine Dodrill
305ae4d8ad log{policy,tail}: set the target correctly
Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-02-03 12:25:24 -05:00
Christine Dodrill
187fc6f1c5 logpolicy: set log target using an environment variable
Signed-off-by: Christine Dodrill <xe@tailscale.com>
2021-02-03 11:42:01 -05:00
4 changed files with 17 additions and 0 deletions

View File

@@ -429,6 +429,10 @@ func (b *LocalBackend) Start(opts Options) error {
return fmt.Errorf("loading requested state: %v", err)
}
if b.prefs.LogServer == "" {
b.prefs.LogServer = "https://log.tailscale.io"
}
os.Setenv("TAILSCALE_LOG_TARGET", b.prefs.LogServer)
b.inServerMode = b.prefs.ForceDaemon
b.serverURL = b.prefs.ControlURL
hostinfo.RoutableIPs = append(hostinfo.RoutableIPs, b.prefs.AdvertiseRoutes...)

View File

@@ -124,6 +124,10 @@ type Prefs struct {
// We can maybe do that once we're sure which module should persist
// it (backend or frontend?)
Persist *controlclient.Persist `json:"Config"`
// The target server where logs should be sent. If not set this will
// default to https://log.tailscale.io.
LogServer string
}
// IsEmpty reports whether p is nil or pointing to a Prefs zero value.

View File

@@ -48,4 +48,5 @@ var _PrefsNeedsRegeneration = Prefs(struct {
NoSNAT bool
NetfilterMode router.NetfilterMode
Persist *controlclient.Persist
LogServer string
}{})

View File

@@ -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