syslogngctl

package module
v0.0.0-...-83879ef Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const StatsHeader = "SourceName;SourceId;SourceInstance;State;Type;Number"

Variables

This section is empty.

Functions

func ConfigID

func ConfigID(ctx context.Context, cc ControlChannel) (string, error)

PreprocessedConfig sends the CONFIG ID command to syslog-ng

func GetLicenseInfo

func GetLicenseInfo(ctx context.Context, cc ControlChannel) (string, error)

GetLicenseInfo sends the LICENSE command to syslog-ng

func License

func License(ctx context.Context, cc ControlChannel) (string, error)

License returns the license of syslog-ng as reported by itself

OSE response: You are using the Open Source Edition of syslog-ng. PE response: TODO

func OriginalConfig

func OriginalConfig(ctx context.Context, cc ControlChannel) (string, error)

OriginalConfig sends the CONFIG GET ORIGINAL command to syslog-ng

func Ping

func Ping(ctx context.Context, cc ControlChannel) error

Ping checks whether syslog-ng is listening on the control channel

func PreprocessedConfig

func PreprocessedConfig(ctx context.Context, cc ControlChannel) (string, error)

PreprocessedConfig sends the CONFIG GET PREPROCESSED command to syslog-ng

func Reload

func Reload(ctx context.Context, cc ControlChannel) error

Reload sends the reload command to the syslog-ng instance behind the control channel

func StatsPrometheus

func StatsPrometheus(ctx context.Context, cc ControlChannel, lastMetricQueryTime *time.Time) ([]*io_prometheus_client.MetricFamily, error)

Types

type CommandFailure

type CommandFailure string

func (CommandFailure) Error

func (err CommandFailure) Error() string

type ControlChannel

type ControlChannel interface {
	SendCommand(ctx context.Context, cmd string) (rsp string, err error)
}

func NewUnixDomainSocketControlChannel

func NewUnixDomainSocketControlChannel(socketAddr string) ControlChannel

type Controller

type Controller struct {
	ControlChannel ControlChannel
	// contains filtered or unexported fields
}

Controller implements syslog-ng-ctl's functionality.

Reference for available commands in syslog-ng-ctl's source code: https://github.com/syslog-ng/syslog-ng/blob/0e7c762c704efbda0ae10b61c35700ef0bdbb9c1/syslog-ng-ctl/syslog-ng-ctl.c#L111

func NewController

func NewController(controlChannel ControlChannel) *Controller

func (*Controller) GetLicenseInfo

func (c *Controller) GetLicenseInfo(ctx context.Context) (string, error)

func (*Controller) OriginalConfig

func (c *Controller) OriginalConfig(ctx context.Context) (string, error)

func (*Controller) Ping

func (c *Controller) Ping(ctx context.Context) error

func (*Controller) PreprocessedConfig

func (c *Controller) PreprocessedConfig(ctx context.Context) (string, error)

func (*Controller) Reload

func (c *Controller) Reload(ctx context.Context) error

func (*Controller) Stats

func (c *Controller) Stats(ctx context.Context) ([]Stat, error)

func (*Controller) StatsPrometheus

func (c *Controller) StatsPrometheus(ctx context.Context) ([]*io_prometheus_client.MetricFamily, error)

type InvalidStatLine

type InvalidStatLine string

func (InvalidStatLine) Error

func (err InvalidStatLine) Error() string

type MetricTypeMismatch

type MetricTypeMismatch struct {
	ActualMetricFamily *io_prometheus_client.MetricFamily
	ExpectedType       io_prometheus_client.MetricType
}

func (MetricTypeMismatch) Error

func (e MetricTypeMismatch) Error() string

type MissingResponseTerminator

type MissingResponseTerminator struct {
	Response []byte
}

func (MissingResponseTerminator) Error

func (err MissingResponseTerminator) Error() string

type ReadWriterControlChannel

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

func NewReadWriterControlChannel

func NewReadWriterControlChannel(rwCtor func(ctx context.Context) (io.ReadWriter, error)) *ReadWriterControlChannel

NewReadWriterControlChannel creates an object that can send a syslog-ng-ctl command and return the response.

rwCtor should returns a ReadWriter with the open socket and an error. If the ReadWriter also implements Closer, it will be closed at the end of the interaction.

func (ReadWriterControlChannel) SendCommand

func (r ReadWriterControlChannel) SendCommand(ctx context.Context, cmd string) (rsp string, err error)

type SourceState

type SourceState byte
const (
	SourceStateActive   SourceState = 'a'
	SourceStateDynamic  SourceState = 'd'
	SourceStateOrphaned SourceState = 'o'
)

type Stat

type Stat struct {
	SourceName     string
	SourceID       string
	SourceInstance string
	SourceState    SourceState
	Type           string
	Number         uint64
}

func Stats

func Stats(ctx context.Context, cc ControlChannel) ([]Stat, error)

type UnexpectedResponse

type UnexpectedResponse string

func (UnexpectedResponse) Error

func (err UnexpectedResponse) Error() string

type UnsupportedMetricType

type UnsupportedMetricType io_prometheus_client.MetricType

func (UnsupportedMetricType) Error

func (e UnsupportedMetricType) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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