hec

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultChannelSize is the default size of the data channel
	DefaultChannelSize = 100

	// DefaultHTTPTimeout is the default timeout for HTTP requests
	DefaultHTTPTimeout = 30 * time.Second
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config holds configuration for HEC output

type HEC

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

HEC implements the Output interface for Splunk HTTP Event Collector

func New

func New(logger *zap.Logger, opts ...Option) (*HEC, error)

New creates a new HEC output instance

func (*HEC) Stop

func (h *HEC) Stop(ctx context.Context) error

Stop gracefully shuts down all workers

func (*HEC) Write

func (h *HEC) Write(ctx context.Context, data output.LogRecord) error

Write sends data to the HEC output channel for processing by workers.

type Option

type Option func(*Config) error

Option is a functional option for configuring the HEC output

func WithACKPollInterval

func WithACKPollInterval(interval time.Duration) Option

WithACKPollInterval sets how often to poll for ACK status

func WithACKTimeout

func WithACKTimeout(timeout time.Duration) Option

WithACKTimeout sets how long to wait for an ACK before resending

func WithBatchSize

func WithBatchSize(size int) Option

WithBatchSize sets the maximum number of events per batch

func WithBatchTimeout

func WithBatchTimeout(timeout time.Duration) Option

WithBatchTimeout sets the maximum time to wait before flushing a partial batch

func WithEnableACK

func WithEnableACK(enable bool) Option

WithEnableACK enables or disables Splunk indexer acknowledgement

func WithEnableTLS

func WithEnableTLS(enable bool) Option

WithEnableTLS enables TLS for HEC connections

func WithEventFormat

func WithEventFormat(format string) Option

WithEventFormat sets the event format: "raw" or "parsed"

func WithHost

func WithHost(host string) Option

WithHost sets the target host for HEC connections

func WithIndex

func WithIndex(index string) Option

WithIndex sets the target index for HEC events

func WithMaxRetries

func WithMaxRetries(retries int) Option

WithMaxRetries sets the maximum number of resend attempts per batch

func WithPort

func WithPort(port string) Option

WithPort sets the target port for HEC connections

func WithSource

func WithSource(source string) Option

WithSource sets the default source metadata for HEC events

func WithSourceType

func WithSourceType(sourceType string) Option

WithSourceType sets the default sourcetype metadata for HEC events

func WithTLSConfig

func WithTLSConfig(tlsConfig *tls.Config) Option

WithTLSConfig sets the TLS configuration for secure connections

func WithToken

func WithToken(token string) Option

WithToken sets the Splunk HEC authentication token

func WithWorkers

func WithWorkers(workers int) Option

WithWorkers sets the number of worker goroutines

Jump to

Keyboard shortcuts

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