parser

package
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Dec 23, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const CommonLogFormat = "02/Jan/2006:15:04:05 -0700"

Variables

This section is empty.

Functions

func RegisterParser

func RegisterParser(m ParserMeta)

Types

type CaddyJsonLog

type CaddyJsonLog struct {
	Msg       string              `json:"msg"`
	Timestamp float64             `json:"ts"` // (unix_seconds_float)
	Request   CaddyJsonLogRequest `json:"request"`
	Size      uint64              `json:"size"`
}

type CaddyJsonLogHeader

type CaddyJsonLogHeader struct {
	Useragent []string `json:"User-Agent"`
}

type CaddyJsonLogRequest

type CaddyJsonLogRequest struct {
	RemoteIP string             `json:"remote_ip"`
	ClientIP string             `json:"client_ip"`
	Uri      string             `json:"uri"`
	Headers  CaddyJsonLogHeader `json:"headers"`
}

type GoAccessFormatParser

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

func (GoAccessFormatParser) Parse

func (p GoAccessFormatParser) Parse(line []byte) (LogItem, error)

type InvalidParserError added in v0.1.4

type InvalidParserError string

func (InvalidParserError) Error added in v0.1.4

func (err InvalidParserError) Error() string

type LogItem

type LogItem struct {
	Size      uint64
	Client    string
	Time      time.Time
	URL       string
	Server    string
	Useragent string

	// Parsers wishing to discard this log item can set Discard to true.
	Discard bool
}

func ParseCaddyJSON

func ParseCaddyJSON(line []byte) (LogItem, error)

func ParseNginxCombined

func ParseNginxCombined(line []byte) (logItem LogItem, err error)

func ParseNginxCombinedRegex

func ParseNginxCombinedRegex(line []byte) (LogItem, error)

func ParseNginxJSON

func ParseNginxJSON(line []byte) (LogItem, error)

func ParseRsyncProxy added in v0.1.1

func ParseRsyncProxy(line []byte) (LogItem, error)

func ParseTencentCDN

func ParseTencentCDN(line []byte) (logItem LogItem, err error)

type NewFunc

type NewFunc func() Parser

type NginxJSONLog

type NginxJSONLog struct {
	Size      uint64  `json:"size"`
	Client    string  `json:"clientip"`
	Url       string  `json:"url"`
	Timestamp float64 `json:"timestamp"`
	ServerIP  string  `json:"serverip"`
	Useragent string  `json:"user_agent"`
}

type Parser

type Parser interface {
	Parse(line []byte) (LogItem, error)
}

func GetParser

func GetParser(name string) (Parser, error)

type ParserFunc

type ParserFunc func(line []byte) (LogItem, error)

func (ParserFunc) Parse

func (p ParserFunc) Parse(line []byte) (LogItem, error)

type ParserMeta

type ParserMeta struct {
	Name        string
	Description string
	Hidden      bool
	F           NewFunc
}

func All

func All() []ParserMeta

Jump to

Keyboard shortcuts

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