Files
Joe Tsai 39d8cc3100 logtail: add support for authenticated log uploads
Control via tailcfg.NodeAttrLogUploadAuth may notify the node
that there is an authorization token to use when uploading logs.
If specified, then the logtail.Logger will use that token
when uploading.

Unfortunately, there is a time-of-use and time-of-check discrepency
that complicates logging. When logs are written under the context
of being for a particular node, we cannot store the token,
as it may be invalid by the time that the logs are uploaded.

Instead, we add Logger.SetAuthID to annotate subsequent log entries
with an identifier for the token to later use.
Only when we upload do we strip out the auth ID, lookup the
auth token to use, and then perform the upload.

We assume that control will notify the client of new tokens
well before they expire. Fetching a refreshed token
is not the job of the client.

Updates tailscale/corp#39092

Signed-off-by: Joe Tsai <[email protected]>
2026-07-15 14:23:36 -07:00
..