cloudflaretarget

package
v0.40.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2024 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Fields

func Fields(t FieldsType, additionalFields []string) ([]string, error)

Fields returns the union of a set of fields represented by the Fieldtype and the given additional fields. The returned slice will contain no duplicates.

Types

type Client

type Client interface {
	LogpullReceived(ctx context.Context, start, end time.Time) (cloudflare.LogpullReceivedIterator, error)
}

Client is a wrapper around the Cloudflare API that allow for testing and being zone/fields aware.

type Config

type Config struct {
	APIToken         string
	ZoneID           string
	Labels           model.LabelSet
	Workers          int
	PullRange        model.Duration
	FieldsType       string
	AdditionalFields []string
}

Config defines how to connect to Cloudflare's Logpull API.

type FieldsType

type FieldsType string

FieldsType defines the set of fields to fetch alongside logs.

const (
	FieldsTypeDefault  FieldsType = "default"
	FieldsTypeMinimal  FieldsType = "minimal"
	FieldsTypeExtended FieldsType = "extended"
	FieldsTypeAll      FieldsType = "all"
	FieldsTypeCustom   FieldsType = "custom"
)

Valid FieldsType values.

type Metrics

type Metrics struct {
	Entries prometheus.Counter
	LastEnd prometheus.Gauge
	// contains filtered or unexported fields
}

Metrics holds a set of cloudflare metrics.

func NewMetrics

func NewMetrics(reg prometheus.Registerer) *Metrics

NewMetrics creates a new set of cloudflare metrics. If reg is non-nil, the metrics will be registered.

type Target

type Target struct {
	// contains filtered or unexported fields
}

Target enables pulling HTTP log messages from Cloudflare using the Logpull API.

func NewTarget

func NewTarget(metrics *Metrics, logger log.Logger, handler loki.EntryHandler, position positions.Positions, config *Config) (*Target, error)

NewTarget creates and runs a Cloudflare target.

func (*Target) Details

func (t *Target) Details() map[string]string

Details returns debug details about the Cloudflare target.

func (*Target) Labels

func (t *Target) Labels() model.LabelSet

Labels returns the custom labels attached to log entries.

func (*Target) Ready

func (t *Target) Ready() bool

Ready reports whether the target is ready.

func (*Target) Stop

func (t *Target) Stop()

Stop shuts down the target.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL