Documentation
¶
Index ¶
- type BackoffConfig
- type BasicAuth
- type LokiLog
- func (l *LokiLog) CaddyModule() caddy.ModuleInfo
- func (l *LokiLog) OpenWriter() (io.WriteCloser, error)
- func (l *LokiLog) Provision(ctx caddy.Context) error
- func (l *LokiLog) String() string
- func (l *LokiLog) UnmarshalCaddyfile(d *caddyfile.Dispenser) error
- func (l *LokiLog) Validate() error
- func (l *LokiLog) WriterKey() string
- type LokiWriter
- type OAuth2
- type Secret
- type StrTimeDuration
- type TLSConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BackoffConfig ¶
type BackoffConfig struct {
// Initial backoff time between retries, default is 500ms
MinPeriod StrTimeDuration `json:"min_period,omitempty"`
// Maximum backoff time between retries, default is 5m
MaxPeriod StrTimeDuration `json:"max_period,omitempty"`
// Maximum number of retries to do, default is 10
MaxRetries int `json:"max_retries,omitempty"`
}
type BasicAuth ¶
type BasicAuth struct {
config.BasicAuth `json:",inline"`
Password Secret `json:"password,omitempty"`
}
func (BasicAuth) ToPrometheusBasicAuth ¶
ToPrometheusBasicAuth converts BasicAuth to config.BasicAuth.
type LokiLog ¶
type LokiLog struct {
/*
The URL where Loki is listening, denoted in Loki as http_listen_address and
http_listen_port. If Loki is running in microservices mode, this is the HTTP
URL for the Distributor. Path to the push API needs to be included.
Example: http://example.com:3100/loki/api/v1/push
*/
Url string `json:"url,omitempty"`
/*
Custom HTTP headers to be sent along with each push request.
Be aware that headers that are set by this writer itself (e.g. X-Scope-OrgID) can'T be overwritten.
Example: CF-Access-Client-Id: xxx
[ <labelname>: <labelvalue> ... ]
*/
Headers map[string]string `json:"headers,omitempty"`
/*
The tenant ID used by default to push logs to Loki. If omitted or empty
it assumes Loki is running in single-tenant mode and no X-Scope-OrgID header
is sent.
*/
TenantId string `json:"tenant_id,omitempty"`
/*
Maximum amount of time to wait before sending a batch, even if that
batch isn'T full.
default = 1s
*/
BatchWait StrTimeDuration `json:"batchwait,omitempty"`
/*
Maximum batch size (in bytes) of logs to accumulate before sending
the batch to Loki.
default = 1048576
*/
BatchSize int `json:"batchsize,omitempty"`
// If using basic auth, configures the username and password sent.
BasicAuth *BasicAuth `json:"basic_auth,omitempty"`
// Optional OAuth 2.0 configuration
// Cannot be used at the same time as basic_auth or authorization
Oauth2 *OAuth2 `json:"oauth2,omitempty"`
// Bearer token to send to the server.
BearerToken string `json:"bearer_token,omitempty"`
// File containing bearer token to send to the server.
BearTokenFile string `json:"bearer_token_file,omitempty"`
// HTTP proxy server to use to connect to the server.
ProxyURL string `json:"proxy_url,omitempty"`
// If connecting to a TLS server, configures how the TLS authentication handshake will operate.
TlsConfig TLSConfig `json:"tls_config,omitempty"`
/*
Configures how to retry requests to Loki when a request
fails.
Default backoff schedule:
0.5s, 1s, 2s, 4s, 8s, 16s, 32s, 64s, 128s, 256s(4.267m)
For a total time of 511.5s(8.5m) before logs are lost
*/
BackoffConfig BackoffConfig `json:"backoff_config,omitempty"`
/*
Disable retries of batches that Loki responds to with a 429 status code (TooManyRequests). This reduces
impacts on batches from other tenants, which could end up being delayed or dropped due to exponential backoff.
*/
DropRateLimitedBatches bool `json:"drop_rate_limited_batches,omitempty"`
/*
Static labels to add to all logs being sent to Loki.
Use map like {"foo": "bar"} to add a label foo with
value bar.
*/
Labels map[string]string `json:"labels,omitempty"`
// Maximum time to wait for a server to respond to a request, default is 10s
TimeOut StrTimeDuration `json:"timeout,omitempty"`
/*
Limits the max number of active streams.
Limiting the number of streams is useful as a mechanism to limit memory usage by this instance, which helps
to avoid OOM scenarios.
0 means it is disabled.
default is 0.
*/
MaxStreams int `json:"max_streams,omitempty"`
// Maximum log line byte size allowed without dropping. Example: 256kb, 2M. 0 to disable. default is 0.
MaxLineSize int `json:"max_line_size,omitempty"`
// Whether to truncate lines that exceed max_line_size. No effect if max_line_size is disabled. default is false.
MaxLineSizeTruncate bool `json:"max_line_size_truncate,omitempty"`
// contains filtered or unexported fields
}
LokiLog is a Caddy logger used to send logs to Loki.
func (*LokiLog) CaddyModule ¶
func (l *LokiLog) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
func (*LokiLog) OpenWriter ¶
func (l *LokiLog) OpenWriter() (io.WriteCloser, error)
func (*LokiLog) UnmarshalCaddyfile ¶
UnmarshalCaddyfile sets up the module from Caddyfile tokens. Syntax:
url
headers {
key value
}
tenant_id
batchwait
batchsize
basic_auth {
username
username_file
password
password_file
}
oauth2 {
client_id
client_secret
scopes
token_url
endpoint_params {
key value
}
}
bearer_token
bearer_token_file
proxy_url
tls_config {
ca_file
cert_file
key_file
server_name
insecure_skip_verify
}
backoff_config {
min_period
max_period
max_retries
}
drop_rate_limited_batches
labels {
key value
}
timeout
max_streams
max_line_size
max_line_size_truncate
type LokiWriter ¶
type LokiWriter struct {
// contains filtered or unexported fields
}
func (*LokiWriter) Close ¶
func (w *LokiWriter) Close() error
type OAuth2 ¶
type OAuth2 struct {
config.OAuth2 `json:",inline"`
TlsConfig TLSConfig `json:"tls_config,omitempty"`
ClientSecret Secret `json:"client_secret,omitempty"`
}
func (OAuth2) ToPrometheusOAuth2 ¶
ToPrometheusOAuth2 converts OAuth2 to config.OAuth2.
type StrTimeDuration ¶
func (*StrTimeDuration) FromString ¶
func (t *StrTimeDuration) FromString(raw string) error
func (*StrTimeDuration) MarshalJSON ¶
func (t *StrTimeDuration) MarshalJSON() ([]byte, error)
func (*StrTimeDuration) TimeDuration ¶
func (t *StrTimeDuration) TimeDuration() time.Duration
func (*StrTimeDuration) UnmarshalJSON ¶
func (t *StrTimeDuration) UnmarshalJSON(data []byte) error
Click to show internal directories.
Click to hide internal directories.