transformer

package
v0.9.11 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2020 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FilterOperator

type FilterOperator struct {
	helper.TransformerOperator
	// contains filtered or unexported fields
}

FilterOperator is an operator that filters entries based on matching expressions

func (*FilterOperator) Process

func (f *FilterOperator) Process(ctx context.Context, entry *entry.Entry) error

Process will drop incoming entries that match the filter expression

type FilterOperatorConfig

type FilterOperatorConfig struct {
	helper.TransformerConfig `yaml:",inline"`
	Expression               string  `json:"expr"   yaml:"expr"`
	DropRatio                float64 `json:"drop_ratio"   yaml:"drop_ratio"`
}

FilterOperatorConfig is the configuration of a filter operator

func NewFilterOperatorConfig

func NewFilterOperatorConfig(operatorID string) *FilterOperatorConfig

NewFilterOperatorConfig creates a filter operator config with default values

func (FilterOperatorConfig) Build

Build will build a filter operator from the supplied configuration

type HostMetadata

type HostMetadata struct {
	helper.TransformerOperator
	helper.HostIdentifier
}

HostMetadata is an operator that can add host metadata to incoming entries

func (*HostMetadata) Process

func (h *HostMetadata) Process(ctx context.Context, entry *entry.Entry) error

Process will process an incoming entry using the metadata transform.

func (*HostMetadata) Transform

func (h *HostMetadata) Transform(entry *entry.Entry) (*entry.Entry, error)

Transform will transform an entry, adding the configured host metadata.

type HostMetadataConfig

type HostMetadataConfig struct {
	helper.TransformerConfig    `yaml:",inline"`
	helper.HostIdentifierConfig `yaml:",inline"`
}

HostMetadataConfig is the configuration of a host metadata operator

func NewHostMetadataConfig

func NewHostMetadataConfig(operatorID string) *HostMetadataConfig

NewHostMetadataConfig returns a HostMetadataConfig with default values

func (HostMetadataConfig) Build

Build will build an operator from the supplied configuration

type K8sMetadataDecorator

type K8sMetadataDecorator struct {
	helper.TransformerOperator
	// contains filtered or unexported fields
}

K8sMetadataDecorator is an operator for decorating entries with kubernetes metadata

func (*K8sMetadataDecorator) Process

func (k *K8sMetadataDecorator) Process(ctx context.Context, entry *entry.Entry) error

Process will process an entry received by the k8s_metadata_decorator operator

func (*K8sMetadataDecorator) Start

func (k *K8sMetadataDecorator) Start() error

Start will start the k8s_metadata_decorator operator

type K8sMetadataDecoratorConfig

type K8sMetadataDecoratorConfig struct {
	helper.TransformerConfig `yaml:",inline"`
	PodNameField             entry.Field       `json:"pod_name_field,omitempty"  yaml:"pod_name_field,omitempty"`
	NamespaceField           entry.Field       `json:"namespace_field,omitempty" yaml:"namespace_field,omitempty"`
	CacheTTL                 operator.Duration `json:"cache_ttl,omitempty"       yaml:"cache_ttl,omitempty"`
	Timeout                  operator.Duration `json:"timeout,omitempty"         yaml:"timeout,omitempty"`
}

K8sMetadataDecoratorConfig is the configuration of k8s_metadata_decorator operator

func NewK8sMetadataDecoratorConfig

func NewK8sMetadataDecoratorConfig(operatorID string) *K8sMetadataDecoratorConfig

func (K8sMetadataDecoratorConfig) Build

Build will build a k8s_metadata_decorator operator from the supplied configuration

type MetadataCache

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

MetadataCache is a cache of kubernetes metadata

func (*MetadataCache) Load

func (m *MetadataCache) Load(key string) (MetadataCacheEntry, bool)

Load will return an entry stored in the metadata cache

func (*MetadataCache) Store

func (m *MetadataCache) Store(key string, entry MetadataCacheEntry)

Store will store an entry in the metadata cache

type MetadataCacheEntry

type MetadataCacheEntry struct {
	ExpirationTime time.Time
	Labels         map[string]string
	Annotations    map[string]string
}

MetadataCacheEntry is an entry in the metadata cache

type MetadataOperator

type MetadataOperator struct {
	helper.TransformerOperator
	helper.Labeler
	helper.Identifier
}

MetadataOperator is an operator that can add metadata to incoming entries

func (*MetadataOperator) Process

func (p *MetadataOperator) Process(ctx context.Context, entry *entry.Entry) error

Process will process an incoming entry using the metadata transform.

func (*MetadataOperator) Transform

func (p *MetadataOperator) Transform(entry *entry.Entry) (*entry.Entry, error)

Transform will transform an entry using the labeler and tagger.

type MetadataOperatorConfig

type MetadataOperatorConfig struct {
	helper.TransformerConfig `yaml:",inline"`
	helper.LabelerConfig     `yaml:",inline"`
	helper.IdentifierConfig  `yaml:",inline"`
}

MetadataOperatorConfig is the configuration of a metadata operator

func NewMetadataOperatorConfig

func NewMetadataOperatorConfig(operatorID string) *MetadataOperatorConfig

NewMetadataOperatorConfig creates a new metadata config with default values

func (MetadataOperatorConfig) Build

Build will build a metadata operator from the supplied configuration

type NoopOperator

type NoopOperator struct {
	helper.TransformerOperator
}

NoopOperator is an operator that performs no operations on an entry.

func (*NoopOperator) Process

func (p *NoopOperator) Process(ctx context.Context, entry *entry.Entry) error

Process will forward the entry to the next output without any alterations.

type NoopOperatorConfig

type NoopOperatorConfig struct {
	helper.TransformerConfig `yaml:",inline"`
}

NoopOperatorConfig is the configuration of a noop operator.

func NewNoopOperatorConfig

func NewNoopOperatorConfig(operatorID string) *NoopOperatorConfig

func (NoopOperatorConfig) Build

Build will build a noop operator.

type Op

type Op struct {
	OpApplier
}

Op is a designated operation on an entry

func (Op) MarshalJSON

func (o Op) MarshalJSON() ([]byte, error)

MarshalJSON will marshal an operation as JSON

func (Op) MarshalYAML

func (o Op) MarshalYAML() (interface{}, error)

MarshalYAML will marshal an operation as YAML

func (*Op) UnmarshalJSON

func (o *Op) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into an operation

func (*Op) UnmarshalYAML

func (o *Op) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into an operation

type OpAdd

type OpAdd struct {
	Field entry.Field `json:"field" yaml:"field"`
	Value interface{} `json:"value,omitempty" yaml:"value,omitempty"`

	ValueExpr *string `json:"value_expr,omitempty" yaml:"value_expr,omitempty"`
	// contains filtered or unexported fields
}

OpAdd is an operation for adding fields to an entry

func (*OpAdd) Apply

func (op *OpAdd) Apply(e *entry.Entry) error

Apply will perform the add operation on an entry

func (*OpAdd) Type

func (op *OpAdd) Type() string

Type will return the type of operation

func (*OpAdd) UnmarshalJSON

func (op *OpAdd) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into the add operation

func (*OpAdd) UnmarshalYAML

func (op *OpAdd) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into the add operation

type OpApplier

type OpApplier interface {
	Apply(entry *entry.Entry) error
	Type() string
}

OpApplier is an entity that applies an operation

type OpFlatten

type OpFlatten struct {
	Field entry.RecordField
}

OpFlatten is an operation for flattening fields

func (*OpFlatten) Apply

func (op *OpFlatten) Apply(e *entry.Entry) error

Apply will perform the flatten operation on an entry

func (OpFlatten) MarshalJSON

func (op OpFlatten) MarshalJSON() ([]byte, error)

MarshalJSON will marshal a flatten operation into JSON

func (OpFlatten) MarshalYAML

func (op OpFlatten) MarshalYAML() (interface{}, error)

MarshalYAML will marshal a flatten operation into YAML

func (*OpFlatten) Type

func (op *OpFlatten) Type() string

Type will return the type of operation

func (*OpFlatten) UnmarshalJSON

func (op *OpFlatten) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into a flatten operation

func (*OpFlatten) UnmarshalYAML

func (op *OpFlatten) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into a flatten operation

type OpMove

type OpMove struct {
	From entry.Field `json:"from" yaml:"from,flow"`
	To   entry.Field `json:"to" yaml:"to,flow"`
}

OpMove is an operation for moving entry fields

func (*OpMove) Apply

func (op *OpMove) Apply(e *entry.Entry) error

Apply will perform the move operation on an entry

func (*OpMove) Type

func (op *OpMove) Type() string

Type will return the type of operation

type OpRemove

type OpRemove struct {
	Field entry.Field
}

OpRemove is operation for removing fields from an entry

func (*OpRemove) Apply

func (op *OpRemove) Apply(e *entry.Entry) error

Apply will perform the remove operation on an entry

func (OpRemove) MarshalJSON

func (op OpRemove) MarshalJSON() ([]byte, error)

MarshalJSON will marshal a remove operation into JSON

func (OpRemove) MarshalYAML

func (op OpRemove) MarshalYAML() (interface{}, error)

MarshalYAML will marshal a remove operation into YAML

func (*OpRemove) Type

func (op *OpRemove) Type() string

Type will return the type of operation

func (*OpRemove) UnmarshalJSON

func (op *OpRemove) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into a remove operation

func (*OpRemove) UnmarshalYAML

func (op *OpRemove) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into a remove operation

type OpRetain

type OpRetain struct {
	Fields []entry.Field
}

OpRetain is an operation for retaining fields

func (*OpRetain) Apply

func (op *OpRetain) Apply(e *entry.Entry) error

Apply will perform the retain operation on an entry

func (OpRetain) MarshalJSON

func (op OpRetain) MarshalJSON() ([]byte, error)

MarshalJSON will marshal a retain operation into JSON

func (OpRetain) MarshalYAML

func (op OpRetain) MarshalYAML() (interface{}, error)

MarshalYAML will marshal a retain operation into YAML

func (*OpRetain) Type

func (op *OpRetain) Type() string

Type will return the type of operation

func (*OpRetain) UnmarshalJSON

func (op *OpRetain) UnmarshalJSON(raw []byte) error

UnmarshalJSON will unmarshal JSON into a retain operation

func (*OpRetain) UnmarshalYAML

func (op *OpRetain) UnmarshalYAML(unmarshal func(interface{}) error) error

UnmarshalYAML will unmarshal YAML into a retain operation

type RateLimitConfig

type RateLimitConfig struct {
	helper.TransformerConfig `yaml:",inline"`

	Rate     float64           `json:"rate,omitempty"     yaml:"rate,omitempty"`
	Interval operator.Duration `json:"interval,omitempty" yaml:"interval,omitempty"`
	Burst    uint              `json:"burst,omitempty"    yaml:"burst,omitempty"`
}

RateLimitConfig is the configuration of a rate filter operator.

func NewRateLimitConfig

func NewRateLimitConfig(operatorID string) *RateLimitConfig

func (RateLimitConfig) Build

Build will build a rate limit operator.

type RateLimitOperator

type RateLimitOperator struct {
	helper.TransformerOperator
	// contains filtered or unexported fields
}

RateLimitOperator is an operator that limits the rate of log consumption between operators.

func (*RateLimitOperator) Process

func (p *RateLimitOperator) Process(ctx context.Context, entry *entry.Entry) error

Process will wait until a rate is met before sending an entry to the output.

func (*RateLimitOperator) Start

func (p *RateLimitOperator) Start() error

Start will start the rate limit operator.

func (*RateLimitOperator) Stop

func (p *RateLimitOperator) Stop() error

Stop will stop the rate limit operator.

type RestructureOperator

type RestructureOperator struct {
	helper.TransformerOperator
	// contains filtered or unexported fields
}

RestructureOperator is an operator that can restructure incoming entries using operations

func (*RestructureOperator) Process

func (p *RestructureOperator) Process(ctx context.Context, entry *entry.Entry) error

Process will process an entry with a restructure transformation.

func (*RestructureOperator) Transform

func (p *RestructureOperator) Transform(entry *entry.Entry) (*entry.Entry, error)

Transform will apply the restructure operations to an entry

type RestructureOperatorConfig

type RestructureOperatorConfig struct {
	helper.TransformerConfig `yaml:",inline"`

	Ops []Op `json:"ops" yaml:"ops"`
}

RestructureOperatorConfig is the configuration of a restructure operator

func NewRestructureOperatorConfig

func NewRestructureOperatorConfig(operatorID string) *RestructureOperatorConfig

func (RestructureOperatorConfig) Build

Build will build a restructure operator from the supplied configuration

type RouterOperator

type RouterOperator struct {
	helper.BasicOperator
	// contains filtered or unexported fields
}

RouterOperator is an operator that routes entries based on matching expressions

func (*RouterOperator) CanOutput

func (p *RouterOperator) CanOutput() bool

CanOutput will always return true for a router operator

func (*RouterOperator) CanProcess

func (p *RouterOperator) CanProcess() bool

CanProcess will always return true for a router operator

func (*RouterOperator) Outputs

func (p *RouterOperator) Outputs() []operator.Operator

Outputs will return all connected operators.

func (*RouterOperator) Process

func (p *RouterOperator) Process(ctx context.Context, entry *entry.Entry) error

Process will route incoming entries based on matching expressions

func (*RouterOperator) SetOutputs

func (p *RouterOperator) SetOutputs(operators []operator.Operator) error

SetOutputs will set the outputs of the router operator.

type RouterOperatorConfig

type RouterOperatorConfig struct {
	helper.BasicConfig `yaml:",inline"`
	Routes             []*RouterOperatorRouteConfig `json:"routes" yaml:"routes"`
}

RouterOperatorConfig is the configuration of a router operator

func NewRouterOperatorConfig

func NewRouterOperatorConfig(operatorID string) *RouterOperatorConfig

func (RouterOperatorConfig) Build

Build will build a router operator from the supplied configuration

func (*RouterOperatorConfig) SetNamespace

func (c *RouterOperatorConfig) SetNamespace(namespace string, exclusions ...string)

SetNamespace will namespace the router operator and the outputs contained in its routes

type RouterOperatorRoute

type RouterOperatorRoute struct {
	helper.Labeler
	Expression      *vm.Program
	OutputIDs       helper.OutputIDs
	OutputOperators []operator.Operator
}

RouterOperatorRoute is a route on a router operator

type RouterOperatorRouteConfig

type RouterOperatorRouteConfig struct {
	helper.LabelerConfig `yaml:",inline"`
	Expression           string           `json:"expr"   yaml:"expr"`
	OutputIDs            helper.OutputIDs `json:"output" yaml:"output"`
}

RouterOperatorRouteConfig is the configuration of a route on a router operator

Directories

Path Synopsis
filter module
hostmetadata module
k8smetadata module
metadata module
ratelimit module
restructure module
router module

Jump to

Keyboard shortcuts

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