followparser

package module
v0.2.2 Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 11 Imported by: 2

README

followparser

followparser is log parser helper. It's useful for visualize logs for examle mackerel plugin.

  • save previous read pos
  • follow rotate logs

usage

See

  • mackerel-plugin-log-incr-rate
  • mackerel-plugin-postfix-log

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DefaultMaxReadSize int64 = 500 * 1000 * 1000

DefaultMaxReadSize : Maximum size for read

Functions

func Parse

func Parse(posFileName, logFile string, cb Callback) error

Types

type Callback added in v0.1.0

type Callback interface {
	Parse(b []byte) error
	Finish(duration float64)
}

type Parsed added in v0.2.0

type Parsed struct {
	FileName string
	Size     int64
	StartPos int64
	EndPos   int64
	Rows     int
}

type Parser added in v0.1.0

type Parser struct {
	WorkDir     string
	MaxReadSize int64
	Callback    Callback
	Silent      bool
}

func (*Parser) Parse added in v0.1.0

func (parser *Parser) Parse(posFileName, logFile string) ([]Parsed, error)

Jump to

Keyboard shortcuts

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