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 Buffer Buffer // temp storage, if nil a MemoryBuffer NewZstdEncoder func() Encoder // if set, used to compress logs for transmission // DrainLogs, if non-nil, disables autmatic uploading of new logs, // so that logs are only uploaded when a token is sent to DrainLogs. DrainLogs <-chan struct{} }
type Logger ¶
type Logger interface { // Write logs an encoded JSON blob. // // If the []byte passed to Write is not an encoded JSON blob, // then contents is fit into a JSON blob and written. // // This is intended as an interface for the stdlib "log" package. Write([]byte) (int, error) // Flush uploads all logs to the server. // It blocks until complete or there is an unrecoverable error. Flush() error // Shutdown gracefully shuts down the logger while completing any // remaining uploads. // // It will block, continuing to try and upload unless the passed // context object interrupts it by being done. // If the shutdown is interrupted, an error is returned. Shutdown(context.Context) error // Close shuts down this logger object, the background log uploader // process, and any associated goroutines. // // DEPRECATED: use Shutdown Close() }
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 |
---|---|
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. |