Documentation ¶
Index ¶
Constants ¶
const ( JSONContentType = "application/json" // Label reserved to override the tenant ID while processing // pipeline stages ReservedLabelTenantID = "__tenant_id__" LatencyLabel = "filename" HostLabel = "host" )
const ( BatchWait = 1 * time.Second BatchSize int = 1024 * 1024 MinBackoff = 500 * time.Millisecond MaxBackoff = 5 * time.Minute MaxRetries int = 10 Timeout = 10 * time.Second )
NOTE the helm chart for promtail and fluent-bit also have defaults for these values, please update to match if you make changes here.
Variables ¶
var (
UserAgent = fmt.Sprintf("promtail/%s", version.Version)
)
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client for pushing logs in snappy-compressed protos over HTTP.
func NewWithDefault ¶
NewWithDefault creates a new client with default configuration.
func NewWithLogger ¶
NewWithLogger makes a new Client from a logger and a config
func (*Client) Handle ¶
Handle implement EntryHandler; adds a new line to the next batch; send is async.
func (*Client) UnregisterLatencyMetric ¶
type Config ¶
type Config struct { URL urlutil.URLValue BatchWait time.Duration BatchSize int Client config.HTTPClientConfig `yaml:",inline"` BackoffConfig backoff.BackoffConfig `yaml:"backoff_config"` // The labels to add to any time series or alerts when communicating with loki ExternalLabels labelutil.LabelSet `yaml:"external_labels,omitempty"` Timeout time.Duration `yaml:"timeout"` // The tenant ID to use when pushing logs to Loki (empty string means // single tenant mode) TenantID string `yaml:"tenant_id"` // Use Loki JSON api as opposed to the snappy protobuf. EncodeJson bool `yaml:"encode_json"` }
Config describes configuration for a HTTP pusher client.
func NewDefaultConfig ¶
NewDefaultConfig creates a default configuration for a given target Loki URL.
func (*Config) RegisterFlags ¶
RegisterFlags registers flags.
func (*Config) RegisterFlagsWithPrefix ¶
RegisterFlags with prefix registers flags where every name is prefixed by prefix. If prefix is a non-empty string, prefix should end with a period.
func (*Config) UnmarshalYAML ¶
UnmarshalYAML implement Yaml Unmarshaler