Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func LogstashRateLimit ¶ added in v0.11.0
LogstashRateLimit adds rate limiting to logs sending. Logs send in higher rate (log lines per seconds) will be discarded.
func LogstashSizeLimit ¶ added in v0.11.0
LogstashSizeLimit adds size limiting to logs sending. Logs that exceeds passed size (in bytes) will be discarded.
func NewConsulLogstashWriter ¶ added in v0.11.0
func NewConsulLogstashWriter(protocol, serviceName string, refreshInterval time.Duration, dialer *net.Dialer) (io.Writer, error)
NewConsulLogstashWriter creates a new writer that will write data to instances provided by local Consul agent. It will use round robin algorithm to spread logs evenly to every Logstash instance. For TCP connections customised dialer can be optionally passed to have more control over how the connections are made.
Types ¶
type Appender ¶
type Appender interface {
Append(entries <-chan servicelog.Entry)
}
Appender delivers service log entries to their destination.
func LogstashAppenderFromEnv ¶ added in v0.11.0
LogstashAppenderFromEnv creates the appender from the environment variables.
func NewLogstash ¶
NewLogstash creates new appender that will send log entries to Logstash using passed writer.
Example ¶
package main import ( "log" "net" "github.com/allegro/mesos-executor/servicelog/appender" ) func main() { // create writer that will be used to send logs writer, err := net.DialUDP("udp", nil, nil) if err != nil { log.Fatal(err) } // create appender with desired options _, err = appender.NewLogstash(writer, appender.LogstashRateLimit(100), appender.LogstashSizeLimit(16000)) if err != nil { log.Fatal(err) } }
Output: