file

package
v1.12.0-rc.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: Apache-2.0 Imports: 38 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Arguments

type Arguments struct {
	Targets              []discovery.Target   `alloy:"targets,attr"`
	ForwardTo            []loki.LogsReceiver  `alloy:"forward_to,attr"`
	Encoding             string               `alloy:"encoding,attr,optional"`
	DecompressionConfig  DecompressionConfig  `alloy:"decompression,block,optional"`
	FileWatch            FileWatch            `alloy:"file_watch,block,optional"`
	FileMatch            FileMatch            `alloy:"file_match,block,optional"`
	TailFromEnd          bool                 `alloy:"tail_from_end,attr,optional"`
	LegacyPositionsFile  string               `alloy:"legacy_positions_file,attr,optional"`
	OnPositionsFileError OnPositionsFileError `alloy:"on_positions_file_error,attr,optional"`
}

Arguments holds values which are used to configure the loki.source.file component.

func (*Arguments) SetToDefault

func (a *Arguments) SetToDefault()

func (*Arguments) Validate

func (a *Arguments) Validate() error

type Component

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

Component implements the loki.source.file component.

func New

func New(o component.Options, args Arguments) (*Component, error)

New creates a new loki.source.file component.

func (*Component) DebugInfo

func (c *Component) DebugInfo() any

DebugInfo returns information about the status of tailed targets. TODO(@tpaschalis) Decorate with more debug information once it's made available, such as the last time a log line was read.

func (*Component) IsStopping added in v1.7.0

func (c *Component) IsStopping() bool

func (*Component) Run

func (c *Component) Run(ctx context.Context) error

Run implements component.Component.

func (*Component) Update

func (c *Component) Update(args component.Arguments) error

Update implements component.Component.

type CompressionFormat

type CompressionFormat string

func (CompressionFormat) MarshalText

func (ut CompressionFormat) MarshalText() (text []byte, err error)

MarshalText implements encoding.TextMarshaler.

func (CompressionFormat) String

func (ut CompressionFormat) String() string

func (*CompressionFormat) UnmarshalText

func (ut *CompressionFormat) UnmarshalText(text []byte) error

UnmarshalText implements encoding.TextUnmarshaler.

type DecompressionConfig

type DecompressionConfig struct {
	Enabled      bool              `alloy:"enabled,attr"`
	InitialDelay time.Duration     `alloy:"initial_delay,attr,optional"`
	Format       CompressionFormat `alloy:"format,attr"`
}

type FileMatch

type FileMatch struct {
	Enabled         bool          `alloy:"enabled,attr,optional"`
	SyncPeriod      time.Duration `alloy:"sync_period,attr,optional"`
	IgnoreOlderThan time.Duration `alloy:"ignore_older_than,attr,optional"`
}

func (*FileMatch) SetToDefault

func (a *FileMatch) SetToDefault()

func (*FileMatch) Validate

func (a *FileMatch) Validate() error

type FileWatch

type FileWatch struct {
	MinPollFrequency time.Duration `alloy:"min_poll_frequency,attr,optional"`
	MaxPollFrequency time.Duration `alloy:"max_poll_frequency,attr,optional"`
}

func (*FileWatch) SetToDefault

func (a *FileWatch) SetToDefault()

type OnPositionsFileError

type OnPositionsFileError string
const (
	OnPositionsFileErrorSkip             OnPositionsFileError = "skip"
	OnPositionsFileErrorRestartEnd       OnPositionsFileError = "restart_from_end"
	OnPositionsFileErrorRestartBeginning OnPositionsFileError = "restart_from_beginning"
)

func (OnPositionsFileError) MarshalText

func (o OnPositionsFileError) MarshalText() ([]byte, error)

func (*OnPositionsFileError) UnmarshalText

func (o *OnPositionsFileError) UnmarshalText(text []byte) error

type Scheduler

type Scheduler[K comparable] struct {
	// contains filtered or unexported fields
}

Scheduler manages the lifecycle of sources. It is not safe for concurrent use: callers must ensure proper synchronization when accessing or modifying Scheduler and its sources from multiple goroutines.

func NewScheduler

func NewScheduler[K comparable]() *Scheduler[K]

func (*Scheduler[K]) Contains

func (s *Scheduler[K]) Contains(k K) bool

Contains returns true if a source with provided k already exists.

func (*Scheduler[K]) Len

func (s *Scheduler[K]) Len() int

Len returns number of scheduled sources

func (*Scheduler[K]) ScheduleSource

func (s *Scheduler[K]) ScheduleSource(source Source[K])

ScheduleSource will register and run the provided source in a goroutine. If a source with the same key already exists it will do nothing.

func (*Scheduler[K]) Sources

func (s *Scheduler[K]) Sources() iter.Seq[Source[K]]

Sources returns an iterator of all scheduled sources.

func (*Scheduler[K]) Stop

func (s *Scheduler[K]) Stop()

Stop will stop all running sources and wait for them to finish.

func (*Scheduler[K]) StopSource

func (s *Scheduler[K]) StopSource(source Source[K])

StopSource will unregister provided source and cancel it without waiting for it to stop.

type Source

type Source[K comparable] interface {
	// Run should start the source.
	// It should run until there is no more work or context is canceled.
	Run(ctx context.Context)
	// Key is used to uniquely identify the source.
	Key() K
	// IsRunning reports if source is still running.
	IsRunning() bool
}

type SourceWithRetry

type SourceWithRetry[K comparable] struct {
	// contains filtered or unexported fields
}

SourceWithRetry is used to wrap another source and apply retries when running.

func NewSourceWithRetry

func NewSourceWithRetry[K comparable](source Source[K], config backoff.Config) *SourceWithRetry[K]

func (*SourceWithRetry[K]) IsRunning

func (s *SourceWithRetry[K]) IsRunning() bool

func (*SourceWithRetry[K]) Key

func (s *SourceWithRetry[K]) Key() K

func (*SourceWithRetry[K]) Run

func (s *SourceWithRetry[K]) Run(ctx context.Context)

Directories

Path Synopsis
internal

Jump to

Keyboard shortcuts

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