Documentation ¶
Overview ¶
Package logtail sends logs to log.tailscale.io.
Index ¶
Constants ¶
const DefaultHost = "log.tailscale.io"
DefaultHost is the default host name to upload logs to when Config.BaseURL isn't provided.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer interface { // TryReadLine tries to read a log line from the ring buffer. // If no line is available it returns a nil slice. // If the ring buffer is closed it returns io.EOF. // // The returned slice may point to data that will be overwritten // by a subsequent call to TryReadLine. TryReadLine() ([]byte, error) // Write writes a log line into the ring buffer. Write([]byte) (int, error) }
func NewMemoryBuffer ¶
type Config ¶
type Config struct { Collection string // collection name, a domain name PrivateID PrivateID // machine-specific private identifier BaseURL string // if empty defaults to "https://log.tailscale.io" HTTPC *http.Client // if empty defaults to http.DefaultClient SkipClientTime bool // if true, client_time is not written to logs LowMemory bool // if true, logtail minimizes memory use TimeNow func() time.Time // if set, subsitutes uses of time.Now Stderr io.Writer // if set, logs are sent here instead of os.Stderr StderrLevel int // max verbosity level to write to stderr; 0 means the non-verbose messages only Buffer Buffer // temp storage, if nil a MemoryBuffer NewZstdEncoder func() Encoder // if set, used to compress logs for transmission // DrainLogs, if non-nil, disables automatic uploading of new logs, // so that logs are only uploaded when a token is sent to DrainLogs. DrainLogs <-chan struct{} }
type Logger ¶
type Logger struct {
// contains filtered or unexported fields
}
Logger writes logs, splitting them as configured between local logging facilities and uploading to a log server.
func (*Logger) Flush ¶
Flush uploads all logs to the server. It blocks until complete or there is an unrecoverable error.
func (*Logger) SetLinkMonitor ¶ added in v1.6.0
SetLinkMonitor sets the optional the link monitor.
It should not be changed concurrently with log writes and should only be set once.
func (*Logger) SetVerbosityLevel ¶ added in v1.4.0
SetVerbosityLevel controls the verbosity level that should be written to stderr. 0 is the default (not verbose). Levels 1 or higher are increasingly verbose.
It should not be changed concurrently with log writes.
type PrivateID ¶
type PrivateID [32]byte
PrivateID represents an instance that write logs. Private IDs are only shared with the server when writing logs.
func NewPrivateID ¶
Safely generate a new PrivateId for use in Config objects. You should persist this across runs of an instance of your app, so that it can append to the same log file on each run.
func ParsePrivateID ¶ added in v0.98.0
ParsePrivateID returns a PrivateID from its hex (String) representation.
func (PrivateID) MarshalText ¶
func (*PrivateID) UnmarshalText ¶
type PublicID ¶
PublicID represents an instance in the logs service for reading and adoption. The public ID value is a SHA-256 hash of a private ID.
func ParsePublicID ¶ added in v0.98.0
ParsePublicID returns a PublicID from its hex (String) representation.
func (PublicID) MarshalText ¶
func (*PublicID) UnmarshalText ¶
Directories ¶
Path | Synopsis |
---|---|
Package backoff provides a back-off timer type.
|
Package backoff provides a back-off timer type. |
example
|
|
logreprocess
The logreprocess program tails a log and reprocesses it.
|
The logreprocess program tails a log and reprocesses it. |
logtail
The logtail program logs stdin.
|
The logtail program logs stdin. |
Package filch is a file system queue that pilfers your stderr.
|
Package filch is a file system queue that pilfers your stderr. |