feature/logtail: pull logtail + netlog out to modular features

Removes 434 KB from the minimal Linux binary, or ~3%.

Primarily this comes from not linking in the zstd encoding code.

Fixes #17323

Change-Id: I0a90de307dfa1ad7422db7aa8b1b46c782bfaaf7
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2025-09-28 10:57:22 -07:00
committed by Brad Fitzpatrick
parent e466488a2a
commit 11b770fbc9
19 changed files with 240 additions and 77 deletions
+8 -2
View File
@@ -149,6 +149,8 @@ var syslogf logger.Logf = logger.Discard
//
// At this point we're still the parent process that
// Windows started.
//
// pol may be nil.
func runWindowsService(pol *logpolicy.Policy) error {
go func() {
logger.Logf(log.Printf).JSON(1, "SupportInfo", osdiag.SupportInfo(osdiag.LogSupportInfoReasonStartup))
@@ -169,7 +171,7 @@ func runWindowsService(pol *logpolicy.Policy) error {
}
type ipnService struct {
Policy *logpolicy.Policy
Policy *logpolicy.Policy // or nil if logging not in use
}
// Called by Windows to execute the windows service.
@@ -186,7 +188,11 @@ func (service *ipnService) Execute(args []string, r <-chan svc.ChangeRequest, ch
doneCh := make(chan struct{})
go func() {
defer close(doneCh)
args := []string{"/subproc", service.Policy.PublicID.String()}
publicID := "none"
if service.Policy != nil {
publicID = service.Policy.PublicID.String()
}
args := []string{"/subproc", publicID}
// Make a logger without a date prefix, as filelogger
// and logtail both already add their own. All we really want
// from the log package is the automatic newline.