inputdockerstats

package
v0.0.0-...-7697303 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2017 License: LGPL-3.0 Imports: 14 Imported by: 0

README

gogstash input dockerstats

Synopsis

{
	"input": [
		{
			"type": "docker",

			// (optional), docker endpoint, default: "unix:///var/run/docker.sock"
			"dockerurl": "unix:///var/run/docker.sock",

			// (optional), include docker name pattern, support regular expression of golang, default: []
			"include_patterns": [],

			// (optional), exclude docker name pattern, support regular expression of golang, default: []
			"exclude_patterns": [],

			// (optional), in seconds, stat interval, default: 15
			"stat_interval": 15,

			// (optional), in seconds, docker connection retry interval, default: 10
			"connection_retry_interval": 10

			// (optional), filter the output by mode, available value: "full" | "simple", "simple" mode will remove some messages to make the log smaller, default: "full"
			"log_mode": "full"
		}
	]
}

Documentation

Index

Constants

View Source
const ModuleName = "dockerstats"

ModuleName is the name used in config file

Variables

View Source
var (
	ErrorPingFailed              = errutil.NewFactory("ping docker server failed")
	ErrorListContainerFailed     = errutil.NewFactory("list docker container failed")
	ErrorListenDockerEventFailed = errutil.NewFactory("listen docker event failed")
	ErrorContainerLoopRunning1   = errutil.NewFactory("container log loop running: %s")
	ErrorGetContainerInfoFailed  = errutil.NewFactory("get container info failed")
)

errors

Functions

func InitHandler

func InitHandler(ctx context.Context, raw *config.ConfigRaw) (config.TypeInputConfig, error)

InitHandler initialize the input plugin

func IsMode

func IsMode(s string) bool

IsMode check string is valid enum

Types

type InputConfig

type InputConfig struct {
	config.InputConfig
	DockerURL               string   `json:"dockerurl"`
	IncludePatterns         []string `json:"include_patterns"`
	ExcludePatterns         []string `json:"exclude_patterns"`
	StatInterval            int      `json:"stat_interval"`
	ConnectionRetryInterval int      `json:"connection_retry_interval,omitempty"`
	LogMode                 Mode     `json:"log_mode,omitempty"`
	// contains filtered or unexported fields
}

InputConfig holds the configuration json fields and internal objects

func DefaultInputConfig

func DefaultInputConfig() InputConfig

DefaultInputConfig returns an InputConfig struct with default values

func (*InputConfig) Start

func (t *InputConfig) Start(ctx context.Context, msgChan chan<- logevent.LogEvent) error

Start wraps the actual function starting the plugin

type Mode

type Mode int8

Mode enum for docker stats log mode

const (
	ModeFull Mode = 1 + iota
	ModeSimple
)

List all valid enum of Mode

func ParseMode

func ParseMode(s string) Mode

ParseMode string to enum

func (Mode) MarshalJSON

func (t Mode) MarshalJSON() ([]byte, error)

MarshalJSON return jsonfy []byte of enum

func (Mode) String

func (t Mode) String() string

func (*Mode) UnmarshalJSON

func (t *Mode) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON decode json data to enum

Jump to

Keyboard shortcuts

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