log

package
v1.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format int

Format represents log format type

const (
	Unknown Format = iota
	Nginx
	Apache
	Syslog
	Custom
)

func (Format) String

func (f Format) String() string

String converts Format to string

type Parser

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

Parser implements a log parser with multiple format support

func DefaultParser added in v1.1.3

func DefaultParser() *Parser

DefaultParser creates a new log parser

func (*Parser) DetectFormat

func (p *Parser) DetectFormat(r io.Reader) (Format, error)

DetectFormat auto-detects log format from first few lines

func (*Parser) GetSupportedTypes

func (p *Parser) GetSupportedTypes() []string

GetSupportedTypes returns supported formats

func (*Parser) Parse added in v1.1.2

func (p *Parser) Parse(ctx context.Context, content []byte, metadata map[string]any) (*core.Document, error)

Parse implements the core.Parser interface

func (*Parser) ParseStream

func (p *Parser) ParseStream(ctx context.Context, r io.Reader, metadata map[string]any) (<-chan *core.Document, error)

ParseStream implements the core.Parser interface

func (*Parser) SetChunkOverlap

func (p *Parser) SetChunkOverlap(overlap int)

SetChunkOverlap sets the chunk overlap

func (*Parser) SetChunkSize

func (p *Parser) SetChunkSize(size int)

SetChunkSize sets the chunk size

func (*Parser) SetFormat

func (p *Parser) SetFormat(format Format)

SetFormat sets the log format

func (*Parser) SetPattern

func (p *Parser) SetPattern(pattern string) error

SetPattern sets custom regex pattern

func (*Parser) Supports added in v1.1.2

func (p *Parser) Supports(contentType string) bool

Supports checks if the content type is supported

Jump to

Keyboard shortcuts

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