sourceparse

package
v0.0.0-...-621658c Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CriParser

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

func NewCriParser

func NewCriParser() *CriParser

func (*CriParser) Parse

func (p *CriParser) Parse(line string, log *types.Log) (message string, isPartial bool, err error)

Not safe for concurrent use.

type DockerLog

type DockerLog struct {
	Log    string `json:"log"`
	Stream string `json:"stream"`
	Time   string `json:"time"`
}

DockerLog is the format from docker json logs

func (*DockerLog) MarshalJSON

func (j *DockerLog) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*DockerLog) MarshalJSONBuf

func (j *DockerLog) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*DockerLog) Reset

func (d *DockerLog) Reset()

func (*DockerLog) UnmarshalJSON

func (j *DockerLog) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*DockerLog) UnmarshalJSONFFLexer

func (j *DockerLog) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type DockerParser

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

func NewDockerParser

func NewDockerParser() *DockerParser

func (*DockerParser) MarshalJSON

func (j *DockerParser) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*DockerParser) MarshalJSONBuf

func (j *DockerParser) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*DockerParser) Parse

func (p *DockerParser) Parse(line string, log *types.Log) (message string, isPartial bool, err error)

Parse parses logs in the Docker json log format and combines partial logs. Not safe for concurrent use.

func (*DockerParser) UnmarshalJSON

func (j *DockerParser) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*DockerParser) UnmarshalJSONFFLexer

func (j *DockerParser) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

type KubernetesParser

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

KubernetesParser is a parser for Kubernetes logs. Discovers the log type and parses with the docker or cri parser. Not safe for concurrent use.

func NewKubernetesParser

func NewKubernetesParser() *KubernetesParser

NewKubernetesParser creates a new KubernetesParser.

func (*KubernetesParser) Parse

func (p *KubernetesParser) Parse(line string, log *types.Log) (message string, isPartial bool, err error)

Parse parses a line of text from a file into a log.

type LogTypeParser

type LogTypeParser interface {
	// Parse parses a line of text from a file into a log.
	Parse(line string, log *types.Log) (message string, isPartial bool, err error)
}

LogTypeParser is a function that parses a line of text from a file based on its format. Must assign log.Timestamp, log.ObservedTimestamp, and the types.BodyKeyMessage property of log.Body.

func GetLogTypeParser

func GetLogTypeParser(logType Type) LogTypeParser

type PlaintextParser

type PlaintextParser struct{}

func (*PlaintextParser) Parse

func (p *PlaintextParser) Parse(line string, log *types.Log) (string, bool, error)

type Type

type Type string
const (

	// Docker logs are the json formatted logs from the docker daemon
	LogTypeDocker Type = "docker"
	// Cri logs are the logs from the container runtime interface
	LogTypeCri Type = "cri"
	// Kubernetes logs can be in either docker or cri format
	LogTypeKubernetes Type = "kubernetes"
	// Plain logs are logs that are not in a known format
	LogTypePlain Type = "plain"
)

Jump to

Keyboard shortcuts

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