cmd

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Dec 28, 2021 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AgentCmd

type AgentCmd struct {
	AgentOpts
	Revision string
}

AgentCmd wraps agent mode

func (AgentCmd) Run

func (a AgentCmd) Run(ctx context.Context) error

Run agent app

type AgentOpts

type AgentOpts struct {
	DockerHost string `short:"d" long:"docker" env:"DOCKER_HOST" default:"unix:///var/run/docker.sock" description:"docker host"`

	EnableSyslog bool   `long:"syslog" env:"LOG_SYSLOG" description:"enable logging to syslog"`
	SyslogHost   string `long:"syslog-host" env:"SYSLOG_HOST" default:"127.0.0.1:514" description:"syslog host"`
	SyslogPrefix string `long:"syslog-prefix" env:"SYSLOG_PREFIX" default:"docker/" description:"syslog prefix"`
	SyslogProt   string `long:"syslog-proto" env:"SYSLOG_PROTO" default:"udp4" description:"syslog protocol"`

	EnableFiles   bool   `long:"files" env:"LOG_FILES" description:"enable logging to files"`
	MaxFileSize   int    `long:"max-size" env:"MAX_SIZE" default:"10" description:"size of log triggering rotation (MB)"`
	MaxFilesCount int    `long:"max-files" env:"MAX_FILES" default:"5" description:"number of rotated files to retain"`
	MaxFilesAge   int    `long:"max-age" env:"MAX_AGE" default:"30" description:"maximum number of days to retain"`
	MixErr        bool   `long:"mix-err" env:"MIX_ERR" description:"send error to std output log file"`
	FilesLocation string `long:"loc" env:"LOG_FILES_LOC" default:"logs" description:"log files locations"`

	Excludes     []string      `short:"x" long:"exclude" env:"EXCLUDE" env-delim:"," description:"excluded container names"`
	Includes     []string      `short:"i" long:"include" env:"INCLUDE" env-delim:"," description:"included container names"`
	ExtJSON      bool          `short:"j" long:"json" env:"JSON" description:"wrap message with JSON envelope"`
	DemoMode     bool          `long:"demo" env:"DEMO" description:"demo mode, generates simulated log entries"`
	DemoRecEvery time.Duration `long:"demo-every" env:"DEMO_EVERY" default:"3s" description:"demo interval"`
}

AgentOpts holds all flags and env for agent mode

type ClientCmd

type ClientCmd struct {
	ClientOpts
}

ClientCmd wraps client mode

func (ClientCmd) Run

func (c ClientCmd) Run(ctx context.Context) error

Run client

type ClientOpts

type ClientOpts struct {
	API        string   `short:"a" long:"api" env:"DKLL_API" required:"true" description:"API endpoint (client)"`
	Containers []string `short:"c" description:"show container(s) only"`
	Hosts      []string `short:"h" description:"show host(s) only"`
	Excludes   []string `short:"x" description:"exclude container(s)"`
	ShowTS     bool     `short:"m" description:"show syslog timestamp"`
	ShowPid    bool     `short:"p" description:"show pid"`
	ShowSyslog bool     `short:"s" description:"show syslog messages"`
	FollowMode bool     `short:"f" description:"follow mode"`
	TailMode   bool     `short:"t" description:"tail mode"`
	MaxRecs    int      `short:"n" description:"show N records"`
	Grep       []string `short:"g" description:"grep on entire record"`
	UnGrep     []string `short:"G" description:"un-grep on entire record"`
	TimeZone   string   `long:"tz"  default:"Local" description:"time zone"`
}

ClientOpts holds all flags and env for client mode

type LogLimit

type LogLimit struct {
	MaxSize    int `long:"max-size" env:"MAX_SIZE" default:"100" description:"max log size, in megabytes"`
	MaxBackups int `long:"max-backups" env:"MAX_BACKUPS" default:"10" description:"max number of rotated files"`
	MaxAge     int `long:"max-age" env:"MAX_AGE" default:"30" description:"max age of rotated files, days"`
}

LogLimit hold params limiting log size and age

type ServerCmd

type ServerCmd struct {
	ServerOpts
	Revision string
}

ServerCmd wraps server mode

func (ServerCmd) Run

func (s ServerCmd) Run(ctx context.Context) error

Run server

type ServerOpts

type ServerOpts struct {
	Port               int           `long:"api-port" env:"API_PORT" default:"8080" description:"rest server port"`
	SyslogPort         int           `long:"syslog-port" env:"SYSLOG_PORT" default:"5514" description:"syslog server port"`
	MongoURL           string        `long:"mongo" env:"MONGO" required:"true" description:"mongo URL"`
	MongoTimeout       time.Duration `long:"mongo-timeout" env:"MONGO_TIMEOUT" default:"5s" description:"mongo timeout"`
	MongoMaxSize       int           `long:"mongo-size" env:"MONGO_SIZE" default:"10000000000" description:"max collection size"`
	MongoMaxDocs       int           `long:"mongo-docs" env:"MONGO_DOCS" default:"50000000" description:"max docs in collection"`
	FileBackupLocation string        `long:"backup" default:"" env:"BACK_LOG" description:"backup log files location"`
	EnableMerged       bool          `long:"merged"  env:"BACK_MRG" description:"enable merged log file"`
	LogLimits          struct {
		Container LogLimit `group:"container" namespace:"container" env-namespace:"CONTAINER" description:"container limits"`
		Merged    LogLimit `group:"merged" namespace:"merged" env-namespace:"MERGED" description:"merged log limits"`
	} `group:"limit" namespace:"limit" env-namespace:"LIMIT"`
}

ServerOpts holds all flags and env for server mode

Jump to

Keyboard shortcuts

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