parser

package
v0.7.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Unknown   = -1
	Emergency = 0
	Alert     = 1
	Critical  = 2
	Error     = 3
	Warning   = 4
	Notice    = 5
	Info      = 6
	Debug     = 7
	Trace     = 8
)

Emergency...

Variables

This section is empty.

Functions

func ParseFloat

func ParseFloat(str []byte) (float64, error)

ParseFloat is similar to strconv.ParseFloat, but operates on []byte which can save a string allocation and is therefore faster Note that it currently doesn't support exponents (scientific format of floats)

func ParseInt

func ParseInt(str []byte) (int64, error)

ParseInt is similar to strconv.ParseInt, but operates on []byte which can save a string allocation and is therefore faster

func ParseUInt

func ParseUInt(str []byte) (uint64, error)

ParseUInt is similar to strconv.ParseUint, but operates on []byte which can save a string allocation and is therefore faster

Types

type Log

type Log struct {
	RemoteAddr  string
	Severity    int64
	Timestamp   int64
	Hostname    string
	Application string
	Text        string
	Metadata    map[string]interface{}
}

Log ...

func ParseLineWithFallback

func ParseLineWithFallback(line []byte, remoteAddr string) *Log

ParseLineWithFallback parses an individual line, and creates a message if the line is not valid

func (*Log) Merge added in v0.4.1

func (l *Log) Merge(other *Log)

func (*Log) PrettyPrint

func (l *Log) PrettyPrint()

PrettyPrint ...

type NumError

type NumError struct {
	Func string // the failing function (ParseBool, ParseInt, ParseUint, ParseFloat)
	Num  string // the input
	Err  error  // the reason the conversion failed (e.g. ErrRange, ErrSyntax, etc.)
}

A NumError records a failed conversion.

func (*NumError) Error

func (e *NumError) Error() string

type Parser

type Parser interface {
	WriteLine(line []byte, remoteIP string)
	Flush() error
	Stop() error
}

Parser ...

func New

func New(cb ProcessLogFunc) Parser

New ...

type ProcessLogFunc

type ProcessLogFunc func(msg *Log)

ProcessLogFunc ...

type RawLogQuery

type RawLogQuery struct {
	Limit      int
	Resolution string
	Filter     string
	GroupBy    []string
	Aggs       []string
	Order      []string
}

RawLogQuery is used by the rawlogquery aql function

type Severity

type Severity int

Severity ...

func SeverityFromString

func SeverityFromString(s string) Severity

SeverityFromString parses Severity from a string

func (Severity) String

func (s Severity) String() string

Jump to

Keyboard shortcuts

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