Documentation ¶
Index ¶
- Constants
- func NewBatch[T BatchRequest](maxStreamConfig int, labels map[string]string, entries ...push.Entry) T
- type Authentication
- type BasicAuthentication
- type BatchRequest
- type Client
- type Config
- type GrpcBatchRequest
- type HttpBatchRequest
- type LogHandler
- type Logger
- type LokiRequestProto
- type NoAuth
- type NoLogger
- type Requesthandler
Constants ¶
View Source
const ( MAX_ERR_MESSAGE_LEN = 1024 DEFAULT_BATCH_MAX_SIZE = 10 DEFAULT_BATCH_MAX_WAIT = 10 * time.Second DEFAULT_REQUEST_TIMEOUT = 30 * time.Second DEFAULT_REQUEST_PROTO = GrpcRequestProto )
View Source
const (
ERROR_STREAM_LIMIT_EXCEED = "streams: %d exceeds limit: %d, stream: '%s'"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Authentication ¶
func NewAuth ¶
func NewAuth(uname, pass string) Authentication
type BasicAuthentication ¶
type BasicAuthentication struct {
// contains filtered or unexported fields
}
func (*BasicAuthentication) Apply ¶
func (b *BasicAuthentication) Apply(req *http.Request)
type BatchRequest ¶
type Client ¶
type Client interface { WithLabels(map[string]string) Client Name() string Chan() chan<- push.Entry Stop() }
Client pushes entries to Loki and can be stopped
type Config ¶
type Config struct { Url string // Push Url of the loki server including http:// or https://, ex: https://example.com/loki/api/v1/push BatchMaxSize int // BatchMaxSize is the maximum number of log lines that are sent in one request. Default: 5 BatchMaxWait time.Duration // BatchMaxWait is the maximum time to wait before sending a request. Default: 10s Timeout time.Duration // Request timeout. Default: 30s RequestProtocol LokiRequestProto // Http or grpc. Default: grpc Logger Logger // Static labels that are added to all log lines. Labels map[string]string // Dynamic labels that are extracted from log fields, and add to log line as Structure Metadata. // Useful when using with logger, ex: log.Info("message", "log_field1", "val1", "log_field2", "val2") // The Key is required, but the Value is fallback when extracted field is empty and it is optional. StructuredMetadata map[string]string // Basic Auth Username string Password string }
func NewWithDefaultConfig ¶
type GrpcBatchRequest ¶
type GrpcBatchRequest struct {
// contains filtered or unexported fields
}
type HttpBatchRequest ¶
type HttpBatchRequest struct {
// contains filtered or unexported fields
}
type LogHandler ¶
type LogHandler func()
type LokiRequestProto ¶
type LokiRequestProto string
const ( GrpcRequestProto LokiRequestProto = "grpc" HttpRequestProto LokiRequestProto = "http" )
type Requesthandler ¶
type Requesthandler func()
Click to show internal directories.
Click to hide internal directories.