syslog

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package syslog is the audit sink adapter for a syslog collector (R-382, design 12 §5.1): RFC 5424 messages over TCP, octet-counted as RFC 5425 and RFC 6587 frame them, with TLS unless the operator turns it off.

Each event is one message. Its MSG is the event as core encoded it, its MSGID the action, and its structured data the event's id and outcome, so a collector can deduplicate a redelivered event (delivery is at least once).

Index

Constants

View Source
const DefaultMaxBatch = 200

DefaultMaxBatch is how many events one Send carries unless max_batch says.

View Source
const Kind = "syslog"

Kind is the adapter's kind string.

Variables

This section is empty.

Functions

func Info

func Info() api.KindInfo

Info describes this kind of adapter for the forms that configure one.

Types

type Adapter

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

Adapter sends to one collector over one connection, reused between batches.

func New

func New() *Adapter

New returns an unconfigured adapter.

func (*Adapter) AuditSinkCapabilities

func (a *Adapter) AuditSinkCapabilities() api.AuditSinkCapabilities

AuditSinkCapabilities reports how core feeds this adapter (R-254).

func (*Adapter) Category

func (a *Adapter) Category() api.Category

func (*Adapter) Configure

func (a *Adapter) Configure(_ context.Context, raw json.RawMessage) error

Configure reads the configuration core assembled.

func (*Adapter) HealthCheck

func (a *Adapter) HealthCheck(ctx context.Context) error

HealthCheck connects, completes the TLS handshake, and hangs up. It sends nothing: a test message would be an event the collector indexes.

Under TLS 1.3 the client's handshake finishes before the server has judged its certificate, so a collector refusing it says so only afterward. A short read waits for that: a collector never writes, so running out of time is the healthy answer, and anything else — an alert, a hang-up — is not.

func (*Adapter) Kind

func (a *Adapter) Kind() string

func (*Adapter) Send

func (a *Adapter) Send(ctx context.Context, b api.AuditBatch) error

Send writes every event in the batch as one framed message each.

type Config

type Config struct {
	Credentials Credentials `json:"credentials,omitzero"`
	sinkkit.Common

	Address        string `json:"address,omitempty"`
	TLS            string `json:"tls,omitempty"`
	CACertificate  string `json:"ca_certificate,omitempty"`
	ServerName     string `json:"server_name,omitempty"`
	AppName        string `json:"app_name,omitempty"`
	Facility       string `json:"facility,omitempty"`
	Hostname       string `json:"hostname,omitempty"`
	TimeoutSeconds int    `json:"timeout_seconds,omitempty"`
}

Config is the adapter's configuration.

type Credentials

type Credentials struct {
	ClientCertificate secret.Value `json:"client_certificate,omitzero"`
	ClientKey         secret.Value `json:"client_key,omitzero"`
}

Credentials is what this adapter keeps secret: a client certificate and its key, for a collector that requires mutual TLS. The certificate is not secret, but it is useless without the key and is set beside it.

Jump to

Keyboard shortcuts

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