1 Star 0 Fork 0

zhangjungang/beats

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
config.go 2.07 KB
一键复制 编辑 原始数据 按行查看 历史
package elasticsearch
import (
"time"
"github.com/elastic/beats/libbeat/outputs"
)
type elasticsearchConfig struct {
Protocol string `config:"protocol"`
Path string `config:"path"`
Params map[string]string `config:"parameters"`
Headers map[string]string `config:"headers"`
Username string `config:"username"`
Password string `config:"password"`
ProxyURL string `config:"proxy_url"`
LoadBalance bool `config:"loadbalance"`
CompressionLevel int `config:"compression_level" validate:"min=0, max=9"`
TLS *outputs.TLSConfig `config:"ssl"`
MaxRetries int `config:"max_retries"`
Timeout time.Duration `config:"timeout"`
SaveTopology bool `config:"save_topology"`
Template Template `config:"template"`
}
type Template struct {
Enabled bool `config:"enabled"`
Name string `config:"name"`
Path string `config:"path"`
Overwrite bool `config:"overwrite"`
Versions TemplateVersions `config:"versions"`
}
type TemplateVersions struct {
Es2x TemplateVersion `config:"2x"`
Es6x TemplateVersion `config:"6x"`
}
type TemplateVersion struct {
Enabled bool `config:"enabled"`
Path string `config:"path"`
}
const (
defaultBulkSize = 50
)
var (
defaultConfig = elasticsearchConfig{
Protocol: "",
Path: "",
ProxyURL: "",
Params: nil,
Username: "",
Password: "",
Timeout: 90 * time.Second,
MaxRetries: 3,
CompressionLevel: 0,
TLS: nil,
LoadBalance: true,
Template: Template{
Enabled: true,
Versions: TemplateVersions{
Es2x: TemplateVersion{Enabled: true},
Es6x: TemplateVersion{Enabled: true},
},
},
}
)
func (c *elasticsearchConfig) Validate() error {
if c.ProxyURL != "" {
if _, err := parseProxyURL(c.ProxyURL); err != nil {
return err
}
}
return nil
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/zhangjungang/beats.git
git@gitee.com:zhangjungang/beats.git
zhangjungang
beats
beats
v5.6.5

搜索帮助

344bd9b3 5694891 D2dac590 5694891