logjson

package
v1.93.15-cluster Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PutParser

func PutParser(p *Parser)

PutParser returns the parser to the pool.

The parser cannot be used after returning to the pool.

Types

type Parser

type Parser struct {
	// Fields contains the parsed JSON line after Parse() call
	//
	// The Fields are valid until the next call to ParseLogMessage()
	// or until the parser is returned to the pool with PutParser() call.
	Fields []logstorage.Field
	// contains filtered or unexported fields
}

Parser parses a single JSON log message into Fields.

See https://docs.victoriametrics.com/VictoriaLogs/keyConcepts.html#data-model

Use GetParser() for obtaining the parser.

func GetParser

func GetParser() *Parser

GetParser returns Parser ready to parse JSON lines.

Return the parser to the pool when it is no longer needed by calling PutParser().

func (*Parser) ParseLogMessage

func (p *Parser) ParseLogMessage(msg []byte) error

ParseLogMessage parses the given JSON log message msg into p.Fields.

The p.Fields remains valid until the next call to ParseLogMessage() or PutParser().

func (*Parser) RenameField

func (p *Parser) RenameField(oldName, newName string)

RenameField renames field with the oldName to newName in p.Fields

Jump to

Keyboard shortcuts

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