outputredis

package
v0.0.0-...-5039c01 Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 8 Imported by: 3

README

gogstash output redis

Synopsis

{
	"output": [
		{
			"type": "redis",

			// (optional)
			"key": "gogstash",

			// (required)
			"host": [""],

			// (optional), default: "list"
			"data_type": "list",

			// (optional), in seconds, default: 5
			"timeout": 5

			// (optional), in seconds, default: 1
			"reconnect_interval": 1
		}
	]
}

Details

  • type
    • Must be "redis"
  • key
    • The name of a Redis list or channel. Dynamic names are valid here, for example “gogstash-%{host}”.
  • host
    • The hostname(s) and port(s) of your Redis server(s). Only one of redis server will be notify. When using redis master/slave, list all redis servers.
["127.0.0.1:6379", "10.20.30.40:6379"]
  • timeout
    • Redis initial connection timeout in seconds.
  • reconnect_interval
    • Interval for reconnecting to failed Redis connections.

Documentation

Index

Constants

View Source
const ErrorTag = "gogstash_output_redis_error"

ErrorTag tag added to event when process module failed

View Source
const ModuleName = "redis"

ModuleName is the name used in config file

Variables

View Source
var (
	ErrorPingFailed           = errutil.NewFactory("ping redis server failed")
	ErrorEventMarshalFailed1  = errutil.NewFactory("event Marshal failed: %v")
	ErrorUnsupportedDataType1 = errutil.NewFactory("unsupported data type: %q")
)

errors

Functions

func InitHandler

func InitHandler(
	ctx context.Context,
	raw config.ConfigRaw,
	control config.Control,
) (config.TypeOutputConfig, error)

InitHandler initialize the output plugin

Types

type OutputConfig

type OutputConfig struct {
	config.OutputConfig
	Host              []string `json:"host"`
	Key               string   `json:"key"`
	DataType          string   `json:"data_type,omitempty"` // one of ["list", "channel"]
	Timeout           int      `json:"timeout,omitempty"`
	ReconnectInterval int      `json:"reconnect_interval,omitempty"`
	Connections       int      `json:"connections"` // maximum number of socket connections, default: 10
	// contains filtered or unexported fields
}

OutputConfig holds the configuration json fields and internal objects

func DefaultOutputConfig

func DefaultOutputConfig() OutputConfig

DefaultOutputConfig returns an OutputConfig struct with default values

func (*OutputConfig) Output

func (t *OutputConfig) Output(ctx context.Context, event logevent.LogEvent) (err error)

Output event

Jump to

Keyboard shortcuts

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