log{policy,tail}: set the target correctly

Signed-off-by: Christine Dodrill <xe@tailscale.com>
This commit is contained in:
Christine Dodrill 2021-02-03 12:25:24 -05:00
parent 187fc6f1c5
commit 305ae4d8ad
2 changed files with 5 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import (
"log"
"net"
"net/http"
"net/url"
"os"
"os/exec"
"path/filepath"
@ -390,6 +391,8 @@ func New(collection string) *Policy {
if val, ok := os.LookupEnv("TAILSCALE_LOG_TARGET_DO_NOT_SET_UNLESS_TOLD_TO"); 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{})

View File

@ -12,6 +12,7 @@ import (
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"os"
"strconv"
@ -51,6 +52,7 @@ type Config struct {
func NewLogger(cfg Config, logf tslogger.Logf) *Logger {
if cfg.BaseURL == "" {
cfg.BaseURL = "https://" + DefaultHost
log.Println("XXX(Xe): set default host")
}
if cfg.HTTPC == nil {
cfg.HTTPC = http.DefaultClient