forked from galaxydi/go-loghub
-
Notifications
You must be signed in to change notification settings - Fork 119
/
Copy pathlog_config_plugin.go
97 lines (88 loc) · 2.35 KB
/
log_config_plugin.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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
package sls
// const PluginInputType
const (
PluginInputTypeDockerStdout = "service_docker_stdout"
PPluginInputTypeCanal = "service_canal"
)
type PluginInputItem struct {
Type string `json:"type"`
Detail PluginInterface `json:"detail"`
}
func CreatePluginInputItem(t string, detail PluginInterface) *PluginInputItem {
return &PluginInputItem{
Type: t,
Detail: detail,
}
}
type LogConfigPluginInput struct {
Inputs []*PluginInputItem `json:"inputs"`
Processors []*PluginInputItem `json:"processors,omitempty"`
Aggregators []*PluginInputItem `json:"aggregators,omitempty"`
Flushers []*PluginInputItem `json:"flushers,omitempty"`
}
type PluginInterface interface {
}
type ConfigPluginCanal struct {
Host string
Port int
User string
Password string
Flavor string
ServerID int
IncludeTables []string
ExcludeTables []string
StartBinName string
StartBinLogPos int
HeartBeatPeriod int
ReadTimeout int
EnableDDL bool
EnableXID bool
EnableGTID bool
EnableInsert bool
EnableUpdate bool
EnableDelete bool
TextToString bool
StartFromBegining bool
Charset string
}
func CreateConfigPluginCanal() *ConfigPluginCanal {
return &ConfigPluginCanal{
Host: "127.0.0.1",
Port: 3306,
User: "root",
Flavor: "mysql",
ServerID: 1205,
HeartBeatPeriod: 60,
ReadTimeout: 90,
EnableGTID: true,
EnableInsert: true,
EnableUpdate: true,
EnableDelete: true,
Charset: "utf8",
}
}
type ConfigPluginDockerStdout struct {
IncludeLabel map[string]string
ExcludeLabel map[string]string
IncludeEnv map[string]string
ExcludeEnv map[string]string
FlushIntervalMs int
TimeoutMs int
BeginLineRegex string
BeginLineTimeoutMs int
BeginLineCheckLength int
MaxLogSize int
Stdout bool
Stderr bool
}
func CreateConfigPluginDockerStdout() *ConfigPluginDockerStdout {
return &ConfigPluginDockerStdout{
FlushIntervalMs: 3000,
TimeoutMs: 3000,
Stdout: true,
Stderr: true,
BeginLineTimeoutMs: 3000,
BeginLineCheckLength: 10 * 1024,
MaxLogSize: 512 * 1024,
}
}