codecjson

package
v0.0.0-...-c13075e Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorTag = "gogstash_codec_json_error"

ErrorTag tag added to event when process module failed

View Source
const ModuleName = "json"

ModuleName is the name used in config file

Variables

This section is empty.

Functions

func InitHandler

InitHandler initialize the codec plugin

Types

type Codec

type Codec struct {
	config.CodecConfig
}

Codec default struct for codec

func (*Codec) Decode

func (c *Codec) Decode(ctx context.Context, data any,
	eventExtra map[string]any, tags []string,
	msgChan chan<- logevent.LogEvent) (ok bool, err error)

Decode returns an event from 'data' as JSON format, adding provided 'eventExtra'

func (*Codec) DecodeEvent

func (c *Codec) DecodeEvent(data []byte, event *logevent.LogEvent) (err error)

DecodeEvent decodes 'data' as JSON format to event

func (*Codec) Encode

func (c *Codec) Encode(ctx context.Context, event logevent.LogEvent, dataChan chan<- []byte) (ok bool, err error)

Encode encodes the event to a JSON encoded message

Jump to

Keyboard shortcuts

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