sink

package
v1.4.2 Latest Latest
Warning

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

Go to latest
Published: May 25, 2026 License: MIT Imports: 21 Imported by: 0

Documentation

Overview

Copyright (c) Tobias Schäfer. All rights reserved. Licensed under the MIT License, see LICENSE file in the project root for details.

Copyright (c) Tobias Schäfer. All rights reserved. Licensed under the MIT License, see LICENSE file in the project root for details.

Copyright (c) Tobias Schäfer. All rights reserved. Licensed under the MIT License, see LICENSE file in the project root for details.

Copyright (c) Tobias Schäfer. All rights reserved. Licensed under the MIT License, see LICENSE file in the project root for details.

Copyright (c) Tobias Schäfer. All rights reserved. Licensed under the MIT License, see LICENSE file in the project root for details.

Index

Constants

View Source
const (
	ExitOnWarningEnv string = "CONNTRACKD_SINK_EXIT_ON_WARNING"
)

Variables

View Source
var LokiProtocols = []string{"http", "https"}

Supported Loki protocols.

View Source
var StreamWriters = []string{"stdout", "stderr", "discard"}

Available stream writers

View Source
var SyslogProtocols = []string{"udp", "tcp", "unix", "unixgram", "unixpacket"}

SyslogProtocols lists the supported syslog protocols.

Functions

This section is empty.

Types

type Config added in v1.0.0

type Config struct {
	Journal Journal
	Syslog  Syslog
	Loki    Loki
	Stream  Stream
}

Config holds the configuration for different logging sinks.

type Journal

type Journal struct {
	Enable bool
}

Journal represents a systemd journal logging sink.

func (*Journal) TargetJournal

func (j *Journal) TargetJournal(options *slog.HandlerOptions) (slog.Handler, error)

TargetJournal creates a sink target for systemd journal logging.

type Loki

type Loki struct {
	Enable  bool
	Address string
	Labels  []string
}

Loki represents Loki logging sink.

func (*Loki) TargetLoki

func (l *Loki) TargetLoki(options *slog.HandlerOptions) (slog.Handler, error)

TargetLoki creates a sink target for Loki.

type Sink

type Sink struct {
	Logger *slog.Logger
}

Sink represents a multi logger sink.

func NewSink added in v1.0.0

func NewSink(config *Config) (*Sink, error)

NewSink creates a new multi logger sink based on the provided configuration.

type SinkTarget

type SinkTarget func(*slog.HandlerOptions) (slog.Handler, error)

SinkTarget defines a function type for initializing a sink target.

type Stream added in v0.2.0

type Stream struct {
	Enable bool
	Writer string
}

Stream represents a standard output stream sink.

func (*Stream) TargetStream added in v0.2.0

func (s *Stream) TargetStream(options *slog.HandlerOptions) (slog.Handler, error)

TargetStream creates a sink target for standard output streams.

type Syslog

type Syslog struct {
	Enable  bool
	Address string
}

Syslog represents the configuration for syslog logging.

func (*Syslog) TargetSyslog

func (s *Syslog) TargetSyslog(options *slog.HandlerOptions) (slog.Handler, error)

TargetSyslog creates a sink target for syslog logging.

Jump to

Keyboard shortcuts

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