Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
Addresses string `env:"ES_LOG_ADDRESSES"`
User string `env:"ES_LOG_USER"`
Pass string `env:"ES_LOG_PASS"`
Index string `env:"ES_LOG_INDEX"`
ESIndex *index.Index
MinLevel slog.Level
ContextFuncs []ContextAttrFunc
ErrorHandler ErrorHandlerFunc
}
func (*Config) ConnectEsLog ¶
ConnectEsLog establishes a connection to Elasticsearch using the configured credentials and initializes the ESIndex client for the specified index. It returns an error if the connection cannot be established.
func (*Config) LoadFromEnv ¶
LoadFromEnv loads configuration from environment variables, optionally reading from a .env file if present. It validates required fields and returns an error if any required field is missing or if there are issues loading the environment variables. The function will not return an error if the .env file is missing, but will return errors for other file-related issues.
func (Config) NewElasticHandler ¶
NewElasticHandler creates a new Handler with the given configuration and options
type ErrorHandlerFunc ¶
type ErrorHandlerFunc func(error)
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func (*Handler) Handle ¶
Handle processes a log record, converting it to a document and sending it to Elasticsearch