readjson

package
v1.29.1 Latest Latest
Warning

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

Go to latest
Published: Mar 10, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Auto ContainerFormat = iota + 1
	CRI
	Docker
	JSONFile

	All Stream = iota + 1
	Stdout
	Stderr
)

Variables

This section is empty.

Functions

func MergeJSONFields

func MergeJSONFields(data util.MapStr, jsonFields util.MapStr, text *string, config Config) (string, time.Time)

MergeJSONFields writes the JSON fields in the event map, respecting the KeysUnderRoot, ExpandKeys, and OverwriteKeys configuration options. If MessageKey is defined, the Text value from the event always takes precedence.

Types

type Config

type Config struct {
	MessageKey          string `config:"message_key"`
	DocumentID          string `config:"document_id"`
	KeysUnderRoot       bool   `config:"keys_under_root"`
	OverwriteKeys       bool   `config:"overwrite_keys"`
	AddErrorKey         bool   `config:"add_error_key"`
	IgnoreDecodingError bool   `config:"ignore_decoding_error"`
	ExpandKeys          bool   `config:"expand_keys"`
}

Config holds the options a JSON reader.

func (*Config) Validate

func (c *Config) Validate() error

Validate validates the Config option for JSON reader.

type ContainerFormat

type ContainerFormat uint8

func (*ContainerFormat) Unpack

func (f *ContainerFormat) Unpack(v string) error

type ContainerJSONConfig

type ContainerJSONConfig struct {
	Stream Stream          `config:"stream"`
	Format ContainerFormat `config:"format"`
}

func DefaultContainerConfig

func DefaultContainerConfig() ContainerJSONConfig

type DockerJSONReader

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

DockerJSONReader processor renames a given field

func New

func New(r reader.Reader, stream string, partial bool, format string, CRIFlags bool) *DockerJSONReader

New creates a new reader renaming a field

func NewContainerParser

func NewContainerParser(r reader.Reader, config *ContainerJSONConfig) *DockerJSONReader

func (*DockerJSONReader) Close

func (p *DockerJSONReader) Close() error

func (*DockerJSONReader) Next

func (p *DockerJSONReader) Next() (reader.Message, error)

Next returns the next line.

type JSONParser

type JSONParser struct {
	JSONReader
	// contains filtered or unexported fields
}

func NewJSONParser

func NewJSONParser(r reader.Reader, cfg *ParserConfig) *JSONParser

func (*JSONParser) Next

func (p *JSONParser) Next() (reader.Message, error)

Next decodes JSON and returns the filled Line object.

type JSONReader

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

JSONReader parses JSON inputs

func NewJSONReader

func NewJSONReader(r reader.Reader, cfg *Config) *JSONReader

NewJSONReader creates a new reader that can decode JSON.

func (*JSONReader) Close

func (r *JSONReader) Close() error

func (*JSONReader) Next

func (r *JSONReader) Next() (reader.Message, error)

Next decodes JSON and returns the filled Line object.

type ParserConfig

type ParserConfig struct {
	Config `config:",inline"`
	Field  string `config:"field"`
	Target string `config:"target"`
}

type Stream

type Stream uint8

func (*Stream) String

func (s *Stream) String() string

func (*Stream) Unpack

func (s *Stream) Unpack(v string) error

Jump to

Keyboard shortcuts

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