Documentation
¶
Overview ¶
Package loki is a logging sink that pushes records to Grafana Loki:
loki.New(loki.Options{URL: "http://localhost:3100", Labels: map[string]string{"app": "shop"}})
Each record is a JSON line in a stream with the sink's labels and the record's level. Unset options come from LOKI_URL, LOKI_USERNAME, LOKI_PASSWORD and LOKI_TENANT_ID.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// URL is Loki's address, such as http://localhost:3100; the push path
// is added. The default is LOKI_URL's, or http://localhost:3100.
URL string
// Labels are every stream's labels. Keep them few and their values
// fixed: Loki indexes streams by them. The default is service, the
// program's name. "level" is added for each record.
Labels map[string]string
// Username and Password are sent as basic authentication, as Grafana
// Cloud wants them.
Username, Password string
// TenantID is sent as X-Scope-OrgID, for multi-tenant Loki.
TenantID string
// Metadata names top-level attributes sent as structured metadata
// (Loki 3 and newer) as well as in the line, such as
// logging.RequestIDKey or logging.TraceIDKey.
Metadata []string
// NoGzip sends requests uncompressed.
NoGzip bool
// Client sends the requests. The default is http.DefaultClient.
Client *http.Client
}
Options configures the sink.
Click to show internal directories.
Click to hide internal directories.