Documentation ¶
Index ¶
- Constants
- Variables
- func IsParseError(err error) bool
- func ReadLastLine(filename string, maxLineWidth int64) ([]byte, error)
- type CSVConfig
- type CSVParser
- type JSONConfig
- type JSONParser
- type LTSVConfig
- type LTSVParser
- type LogLine
- type ParseError
- type Parser
- type ParserConfig
- type Reader
- type RegExpConfig
- type RegExpParser
Constants ¶
View Source
const ( TypeCSV = "csv" TypeLTSV = "ltsv" TypeRegExp = "regexp" TypeJSON = "json" )
View Source
const DefaultMaxLineWidth = 4 * 1024 // assume disk block size is 4K
Variables ¶
View Source
var (
ErrNoMatchedFile = errors.New("no matched files")
)
View Source
var ErrTooLongLine = errors.New("too long line")
Functions ¶
func IsParseError ¶
Types ¶
type CSVParser ¶
type CSVParser struct { Config CSVConfig // contains filtered or unexported fields }
type JSONConfig ¶ added in v0.22.0
type JSONParser ¶ added in v0.22.0
type JSONParser struct {
// contains filtered or unexported fields
}
func NewJSONParser ¶ added in v0.22.0
func NewJSONParser(config JSONConfig, in io.Reader) (*JSONParser, error)
func (*JSONParser) Info ¶ added in v0.22.0
func (p *JSONParser) Info() string
func (*JSONParser) Parse ¶ added in v0.22.0
func (p *JSONParser) Parse(row []byte, line LogLine) error
func (*JSONParser) ReadLine ¶ added in v0.22.0
func (p *JSONParser) ReadLine(line LogLine) error
type LTSVConfig ¶
type LTSVParser ¶
type LTSVParser struct {
// contains filtered or unexported fields
}
func NewLTSVParser ¶
func NewLTSVParser(config LTSVConfig, in io.Reader) (*LTSVParser, error)
func (LTSVParser) Info ¶
func (p LTSVParser) Info() string
func (*LTSVParser) ReadLine ¶
func (p *LTSVParser) ReadLine(line LogLine) error
type ParseError ¶
type ParseError struct {
// contains filtered or unexported fields
}
func (ParseError) Error ¶
func (e ParseError) Error() string
func (ParseError) Unwrap ¶
func (e ParseError) Unwrap() error
type Parser ¶
type ParserConfig ¶
type ParserConfig struct { LogType string `yaml:"log_type"` CSV CSVConfig `yaml:"csv_config"` LTSV LTSVConfig `yaml:"ltsv_config"` RegExp RegExpConfig `yaml:"regexp_config"` JSON JSONConfig `yaml:"json_config"` }
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is a log rotate aware Reader TODO: better reopen algorithm TODO: handle truncate
func Open ¶
Open a file and seek to end of the file. path: the shell file name pattern excludePath: the shell file name pattern
func (*Reader) CurrentFilename ¶
CurrentFilename get current opened file name
type RegExpConfig ¶
type RegExpConfig struct {
Pattern string `yaml:"pattern"`
}
type RegExpParser ¶
type RegExpParser struct {
// contains filtered or unexported fields
}
func NewRegExpParser ¶
func NewRegExpParser(config RegExpConfig, in io.Reader) (*RegExpParser, error)
func (RegExpParser) Info ¶
func (p RegExpParser) Info() string
func (*RegExpParser) ReadLine ¶
func (p *RegExpParser) ReadLine(line LogLine) error
Source Files ¶
Click to show internal directories.
Click to hide internal directories.