Documentation ¶
Index ¶
- Constants
- func ConfigID(ctx context.Context, cc ControlChannel) (string, error)
- func GetLicenseInfo(ctx context.Context, cc ControlChannel) (string, error)
- func License(ctx context.Context, cc ControlChannel) (string, error)
- func OriginalConfig(ctx context.Context, cc ControlChannel) (string, error)
- func Ping(ctx context.Context, cc ControlChannel) error
- func PreprocessedConfig(ctx context.Context, cc ControlChannel) (string, error)
- func Reload(ctx context.Context, cc ControlChannel) error
- func StatsPrometheus(ctx context.Context, cc ControlChannel, lastMetricQueryTime *time.Time) ([]*io_prometheus_client.MetricFamily, error)
- type CommandFailure
- type ControlChannel
- type Controller
- func (c *Controller) GetLicenseInfo(ctx context.Context) (string, error)
- func (c *Controller) OriginalConfig(ctx context.Context) (string, error)
- func (c *Controller) Ping(ctx context.Context) error
- func (c *Controller) PreprocessedConfig(ctx context.Context) (string, error)
- func (c *Controller) Reload(ctx context.Context) error
- func (c *Controller) Stats(ctx context.Context) ([]Stat, error)
- func (c *Controller) StatsPrometheus(ctx context.Context) ([]*io_prometheus_client.MetricFamily, error)
- type InvalidStatLine
- type MetricTypeMismatch
- type MissingResponseTerminator
- type ReadWriterControlChannel
- type SourceState
- type Stat
- type UnexpectedResponse
- type UnsupportedMetricType
Constants ¶
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) PreprocessedConfig ¶
func (c *Controller) PreprocessedConfig(ctx context.Context) (string, 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 ¶
type SourceState ¶
type SourceState byte
const ( SourceStateActive SourceState = 'a' SourceStateDynamic SourceState = 'd' SourceStateOrphaned SourceState = 'o' )
type Stat ¶
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