file

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: May 13, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package file implements a Source backed by a tailed file with rotation support.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Name       string
	Path       string
	Replay     bool // false = skip to end of file at start
	MaxLineLen int  // truncate longer lines before broadcast
}

Config holds the file source's runtime parameters.

type Source

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

Source tails one file and fans out lines to subscribers.

func New

func New(cfg Config) *Source

New constructs a file Source.

func (*Source) Close

func (s *Source) Close() error

Close stops the tailer and closes all subscriber channels.

func (*Source) Name

func (s *Source) Name() string

Name returns the configured source name.

func (*Source) Start

func (s *Source) Start(ctx context.Context) error

Start opens the file with nxadm/tail and begins broadcasting lines.

func (*Source) Subscribe

func (s *Source) Subscribe(name string, bufSize int) <-chan source.LogLine

Subscribe returns the line channel for a named subscriber.

func (*Source) Unsubscribe

func (s *Source) Unsubscribe(name string)

Unsubscribe removes a subscriber and closes its channel; used during daemon.Reload to drop rules that are no longer configured.

Jump to

Keyboard shortcuts

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