output

package
v0.23.0 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package output provides an interface for writing data to various destinations (outputs) in stream. An output is responsible for delivering data, such as log lines or events, to external systems including files, cloud storage, message queues, or network endpoints. Each output implementation encapsulates connection, delivery, and error handling logic specific to its protocol or service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Available

func Available() []string

Available returns a sorted list of registered output protocols.

func Register

func Register(protocol string, factory Factory)

Register registers a new output factory for a given protocol. This is not thread-safe and should only be called from init() functions.

Types

type AzureBlobStorageOptions

type AzureBlobStorageOptions struct {
	Container string // Container is the container name. The container will be created if it does not exist.
	Blob      string // Blob is the blob name to use. The blob will be created inside the container.
	Port      string // Port is the port number used for tests to update the connection string.
}

AzureBlobStorageOptions holds configuration for the Azure Blob Storage output.

type AzureEventHubOptions

type AzureEventHubOptions struct {
	FullyQualifiedNamespace string // FullyQualifiedNamespace is the Event Hubs namespace name (e.g. myeventhub.servicebus.windows.net).
	EventHubName            string // EventHubName is the name of the Event Hub.
	ConnectionString        string // ConnectionString is the connection string to connect to the Event Hub.
}

AzureEventHubOptions holds configuration for the Azure Event Hub output.

type Factory

type Factory func(options *Options) (Output, error)

Factory is a function that creates a new Output.

type GCPPubsubOptions

type GCPPubsubOptions struct {
	Project      string // Project is the Google Cloud project name.
	Topic        string // Topic is the Pub/Sub topic name. The topic will be created if it does not exist.
	Subscription string // Subscription is the Pub/Sub subscription name. The subscription will be created if it does not exist.
	Clear        bool   // Clear removes all topics and subscriptions before running.
}

GCPPubsubOptions holds configuration for the Google Cloud Pub/Sub output.

type GCSOptions added in v0.23.0

type GCSOptions struct {
	// ProjectID is the Google Cloud project ID.
	ProjectID string
	// ObjectContentType is the content-type set for the object that is created in the bucket. Defaults to application/json.
	ObjectContentType string
	// Bucket is the bucket name. The bucket will be created if it does not exist.
	Bucket string
	// Object is the name of the object created inside the related bucket.
	Object string
}

GCSOptions holds configuration for the Google Cloud Storage output.

type KafkaOptions

type KafkaOptions struct {
	Topic string // Topic is the Kafka topic name. The topic will be created if it does not exist.
}

KafkaOptions holds configuration for the Kafka output.

type LumberjackOptions

type LumberjackOptions struct {
	// ParseJSON parses the input bytes as JSON and sends structured data. By default, input bytes are sent in a 'message' field.
	ParseJSON bool
}

LumberjackOptions holds configuration for the Lumberjack output.

type Options

type Options struct {
	Addr           string        // Destination address (host:port).
	Delay          time.Duration // Delay start after start signal.
	Protocol       string        // Protocol (udp/tcp/tls).
	Retries        int           // Number of connection retries for tcp based protocols.
	StartSignal    string        // OS signal to wait on before starting.
	InsecureTLS    bool          // Disable TLS verification checks.
	RateLimit      int           // UDP rate limit in bytes.
	MaxLogLineSize int           // Log reader buffer size in bytes.

	WebhookOptions
	GCPPubsubOptions
	KafkaOptions
	AzureBlobStorageOptions
	AzureEventHubOptions
	LumberjackOptions
	GCSOptions
}

Options holds the configuration for an output.

type Output

type Output interface {
	// DialContext dials the output.
	DialContext(ctx context.Context) error
	io.WriteCloser
}

Output is an io.WriteCloser that can be dialed.

func Initialize

func Initialize(ctx context.Context, opts *Options, logger *zap.SugaredLogger) (Output, error)

Initialize creates and configures a new Output using the provided Options and logger, then attempts to establish a connection with retries. It returns the connected Output or an error if the connection could not be established within the allowed retries or if the provided context is canceled. The logger is used for informational and debug messages during initialization and connection attempts.

func New

func New(opts *Options) (Output, error)

New creates a new Output for the given options. It looks up the protocol in the registry and calls the corresponding factory.

type WebhookOptions

type WebhookOptions struct {
	ContentType string        // Content-Type header.
	Headers     []string      // Headers in Key=Value format.
	Username    string        // Basic auth username.
	Password    string        // Basic auth password.
	Timeout     time.Duration // Timeout for request handling.
	Probe       string        // Server probe behavior.
}

WebhookOptions holds configuration for the webhook output.

Directories

Path Synopsis
Package azureblobstorage provides an output for streaming data to Azure Blob Storage containers.
Package azureblobstorage provides an output for streaming data to Azure Blob Storage containers.
Package azureeventhub provides an output implementation for streaming data to Azure Event Hub.
Package azureeventhub provides an output implementation for streaming data to Azure Event Hub.
Package gcppubsub provides an output implementation for streaming data to Google Cloud Pub/Sub topics.
Package gcppubsub provides an output implementation for streaming data to Google Cloud Pub/Sub topics.
Package gcs provides an output implementation for streaming data to Google Cloud Storage (GCS) buckets.
Package gcs provides an output implementation for streaming data to Google Cloud Storage (GCS) buckets.
Package kafka provides an output implementation for streaming data to Apache Kafka topics.
Package kafka provides an output implementation for streaming data to Apache Kafka topics.
Package lumberjack provides an output for sending events using the Lumberjack protocol, which is the protocol used for communication between Elastic Beats and Logstash when the "Logstash output" is used.
Package lumberjack provides an output for sending events using the Lumberjack protocol, which is the protocol used for communication between Elastic Beats and Logstash when the "Logstash output" is used.
Package netout provides a unified network output supporting tcp, tls, udp, and unix protocols.
Package netout provides a unified network output supporting tcp, tls, udp, and unix protocols.
Package webhook provides an output that sends data to an HTTP or HTTPS endpoint via configurable webhooks.
Package webhook provides an output that sends data to an HTTP or HTTPS endpoint via configurable webhooks.

Jump to

Keyboard shortcuts

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