Skip to content

Commit

Permalink
fluent-bit plugin support tls (#2568)
Browse files Browse the repository at this point in the history
  • Loading branch information
zjj2wry authored Sep 29, 2020
1 parent bffd9a5 commit 1b2bae4
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cmd/fluent-bit/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -258,5 +258,19 @@ func parseConfig(cfg ConfigGetter) (*config, error) {
res.bufferConfig.dqueConfig.queueName = queueName
}

res.clientConfig.Client.TLSConfig.CAFile = cfg.Get("ca_file")
res.clientConfig.Client.TLSConfig.CertFile = cfg.Get("cert_file")
res.clientConfig.Client.TLSConfig.KeyFile = cfg.Get("key_file")

insecureSkipVerify := cfg.Get("insecure_skip_verify")
switch insecureSkipVerify {
case "false", "":
res.clientConfig.Client.TLSConfig.InsecureSkipVerify = false
case "true":
res.clientConfig.Client.TLSConfig.InsecureSkipVerify = true
default:
return nil, fmt.Errorf("invalid string insecure_skip_verify: %v", insecureSkipVerify)
}

return res, nil
}
5 changes: 5 additions & 0 deletions cmd/fluent-bit/out_loki.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func FLBPluginInit(ctx unsafe.Pointer) int {
level.Info(paramLogger).Log("DqueDir", conf.bufferConfig.dqueConfig.queueDir)
level.Info(paramLogger).Log("DqueSegmentSize", conf.bufferConfig.dqueConfig.queueSegmentSize)
level.Info(paramLogger).Log("DqueSync", conf.bufferConfig.dqueConfig.queueSync)
level.Info(paramLogger).Log("ca_file", conf.clientConfig.Client.TLSConfig.CAFile)
level.Info(paramLogger).Log("cert_file", conf.clientConfig.Client.TLSConfig.CertFile)
level.Info(paramLogger).Log("key_file", conf.clientConfig.Client.TLSConfig.KeyFile)
level.Info(paramLogger).Log("insecure_skip_verify", conf.clientConfig.Client.TLSConfig.InsecureSkipVerify)

plugin, err := newPlugin(conf, logger)
if err != nil {
level.Error(logger).Log("newPlugin", err)
Expand Down

0 comments on commit 1b2bae4

Please sign in to comment.