scanner

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: May 29, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Overview

Package scanner parses log files

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(
	cfg *server.Config, store store.Store, registry *prometheus.Registry, scheduler *gocron.Scheduler,
) server.Server

New returns a server that manages scanners.

Types

type Config

type Config struct {
	Follow        bool
	FromBeginning bool
	Poll          bool
	Reopen        bool
}

Config defines the behavior of the scanner

type Metric

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

Metric defines the prometheus counter to increment when a line matches the regular expression.

type Parse added in v0.3.0

type Parse func(context.Context, *tail.Tail, map[string]*Metric) error

Parse implements the custom logic to parse a specific log file type.

type Scanner

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

Scanner scans a log file to extract the given metrics.

func FromConfig

func FromConfig(
	scan *store.Scan, config *Config, registerer prometheus.Registerer,
) (*Scanner, error)

FromConfig creates a new scanner, based on the configuration provided.

func (*Scanner) GetLastModified

func (s *Scanner) GetLastModified() time.Time

GetLastModified returns the last time the scanner configuration was updated.

func (*Scanner) Start

func (s *Scanner) Start(ctx *stopper.Context) error

Start scanning the log

func (*Scanner) Stop

func (s *Scanner) Stop() error

Stop stops the scanning activity.

Jump to

Keyboard shortcuts

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