config.go
1.8 KB
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package config
import (
"time"
"github.com/tal-tech/go-zero/core/service"
)
type (
Condition struct {
Key string
Value string
Type string `json:",default=match,options=match|contains"`
Op string `json:",default=and,options=and|or"`
}
ElasticSearchConf struct {
Hosts []string
Index string
DocType string `json:",default=doc"`
TimeZone string `json:",optional"`
MaxChunkBytes int `json:",default=15728640"` // default 15M
Compress bool `json:",default=false"`
}
PostgresqlConf struct {
Host string
Port string
User string
Password string
DBName string
MaxQueueSize int `json:",default=10000"`
BatchSize int `json:",default=100"`
ThreadSize int `json:",default=2"`
Interval int `json:",default=5"`
SleepInterval int `json:",default=2"`
}
Filter struct {
Action string `json:",options=drop|remove_field|transfer"`
Conditions []Condition `json:",optional"`
Fields []string `json:",optional"`
Field string `json:",optional"`
Target string `json:",optional"`
}
KafkaConf struct {
service.ServiceConf
Brokers []string
Group string
Topics []string
Offset string `json:",options=first|last,default=last"`
Conns int `json:",default=1"`
Consumers int `json:",default=8"`
Processors int `json:",default=8"`
MinBytes int `json:",default=10240"` // 10K
MaxBytes int `json:",default=10485760"` // 10M
}
Cluster struct {
Input struct {
Kafka KafkaConf
}
Filters []Filter `json:",optional"`
Output struct {
ElasticSearch ElasticSearchConf `json:",optional"`
Postgresql PostgresqlConf `json:",optional"`
}
}
Config struct {
Clusters []Cluster
GracePeriod time.Duration `json:",default=10s"`
}
)