forked from elastic/beats
-
Notifications
You must be signed in to change notification settings - Fork 0
/
config.go
50 lines (44 loc) · 1.48 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package logstash
import (
"time"
"github.com/elastic/beats/libbeat/outputs"
"github.com/elastic/beats/libbeat/outputs/transport"
)
type Config struct {
Index string `config:"index"`
Port int `config:"port"`
LoadBalance bool `config:"loadbalance"`
BulkMaxSize int `config:"bulk_max_size"`
SlowStart bool `config:"slow_start"`
Timeout time.Duration `config:"timeout"`
TTL time.Duration `config:"ttl" validate:"min=0"`
Pipelining int `config:"pipelining" validate:"min=0"`
CompressionLevel int `config:"compression_level" validate:"min=0, max=9"`
MaxRetries int `config:"max_retries" validate:"min=-1"`
TLS *outputs.TLSConfig `config:"ssl"`
Proxy transport.ProxyConfig `config:",inline"`
Backoff Backoff `config:"backoff"`
}
type Backoff struct {
Init time.Duration
Max time.Duration
}
var defaultConfig = Config{
Port: 5044,
LoadBalance: false,
Pipelining: 5,
BulkMaxSize: 2048,
SlowStart: false,
CompressionLevel: 3,
Timeout: 30 * time.Second,
MaxRetries: 3,
TTL: 0 * time.Second,
Backoff: Backoff{
Init: 1 * time.Second,
Max: 60 * time.Second,
},
}
func newConfig() *Config {
c := defaultConfig
return &c
}