Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct { Forwarders map[string]*ConfigForwarder `ini:"forwarder"` // Listen is the address where Haminer will bind and receiving // log from HAProxy. Listen string `ini:"haminer::listen"` // AcceptBackend list of backend to be filtered. AcceptBackend []string `ini:"haminer::accept_backend"` // List of request headers to be parsed and mapped as tags in halog // output. RequestHeaders []string `ini:"haminer::capture_request_header"` HttpUrl []string `ini:"preprocess:tag:http_url"` // ForwardInterval define an interval where logs will be forwarded. ForwardInterval time.Duration `ini:"haminer::forward_interval"` // contains filtered or unexported fields }
Config define options to create and run Haminer instance.
func NewConfig ¶
func NewConfig() (cfg *Config)
NewConfig will create, initialize, and return new config with default values.
type ConfigForwarder ¶
type ConfigForwarder struct { Version string `ini:"::version"` Url string `ini:"::url"` Bucket string `ini:"::bucket"` User string `ini:"::user"` Pass string `ini:"::pass"` Org string `ini:"::org"` Token string `ini:"::token"` // contains filtered or unexported fields }
ConfigForwarder contains configuration for forwarding the logs.
type Forwarder ¶
type Forwarder interface {
Forwards(halogs []*HttpLog)
}
Forwarder define an interface to forward parsed HAProxy log to storage engine.
type Haminer ¶
type Haminer struct {
// contains filtered or unexported fields
}
Haminer define the log consumer and producer.
func NewHaminer ¶
NewHaminer create, initialize, and return new Haminer instance. If config parameter is nil, it will use the default options.
type HttpLog ¶
type HttpLog struct { Timestamp time.Time ClientIP string ClientPort int32 FrontendName string BackendName string ServerName string TimeReq int32 TimeWait int32 TimeConnect int32 TimeRsp int32 TimeAll int32 BytesRead int64 CookieReq string CookieRsp string TermState string ConnActive int32 ConnFrontend int32 ConnBackend int32 ConnServer int32 ConnRetries int32 QueueServer int32 QueueBackend int32 RequestHeaders map[string]string HTTPStatus int32 HTTPMethod string HTTPURL string HTTPQuery string HTTPProto string // contains filtered or unexported fields }
HttpLog contains the mapping of haproxy HTTP log format to Go struct.
Reference: https://cbonte.github.io/haproxy-dconv/1.7/configuration.html#8.2.3
type InfluxdClient ¶
type InfluxdClient struct {
// contains filtered or unexported fields
}
InfluxdClient contains HTTP connection for writing logs to Influxd.
func NewInfluxdClient ¶
func NewInfluxdClient(cfg *ConfigForwarder) (cl *InfluxdClient)
NewInfluxdClient will create, initialize, and return new Influxd client.
func (*InfluxdClient) Forwards ¶
func (cl *InfluxdClient) Forwards(halogs []*HttpLog)
Forwards implement the Forwarder interface. It will write all logs to Influxd.