From 4d7f465a646d76dd1fcdc02fd435008b2c479e64 Mon Sep 17 00:00:00 2001 From: liguozhuang Date: Fri, 18 Oct 2024 19:30:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=A4=9A=E4=BD=99=20debug=20?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E4=B8=94=E6=94=AF=E6=8C=81=E6=89=8B=E5=8A=A8?= =?UTF-8?q?=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- internal/plugins/inputs/apache/input.go | 1 + internal/plugins/inputs/container/container_log.go | 2 +- internal/plugins/inputs/elasticsearch/input.go | 1 + internal/plugins/inputs/iis/input.go | 1 + internal/plugins/inputs/influxdb/input.go | 1 + internal/plugins/inputs/jenkins/input.go | 1 + internal/plugins/inputs/kafka/input.go | 2 ++ internal/plugins/inputs/logging/input.go | 2 +- internal/plugins/inputs/mongodb/input.go | 2 ++ internal/plugins/inputs/mysql/input.go | 1 + internal/plugins/inputs/nginx/input.go | 1 + internal/plugins/inputs/postgresql/input.go | 1 + internal/plugins/inputs/rabbitmq/input.go | 1 + internal/plugins/inputs/redis/input.go | 1 + internal/plugins/inputs/solr/input.go | 1 + internal/plugins/inputs/sqlserver/input.go | 1 + internal/plugins/inputs/tdengine/input.go | 2 ++ internal/tailer/option.go | 2 +- 18 files changed, 21 insertions(+), 3 deletions(-) diff --git a/internal/plugins/inputs/apache/input.go b/internal/plugins/inputs/apache/input.go index 1447c626ab..1973663871 100644 --- a/internal/plugins/inputs/apache/input.go +++ b/internal/plugins/inputs/apache/input.go @@ -129,6 +129,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{`^\[\w+ \w+ \d+`}), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/container/container_log.go b/internal/plugins/inputs/container/container_log.go index 1a02a3606a..42d6feee05 100644 --- a/internal/plugins/inputs/container/container_log.go +++ b/internal/plugins/inputs/container/container_log.go @@ -51,7 +51,7 @@ func (c *container) tailingLogs(ins *logInstance) { tailer.WithSource(cfg.Source), tailer.WithService(cfg.Service), tailer.WithPipeline(cfg.Pipeline), - tailer.WithEnableDebugFields(config.Cfg.EnableDebugFields), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithCharacterEncoding(cfg.CharacterEncoding), tailer.WithMultilinePatterns(cfg.MultilinePatterns), tailer.WithGlobalTags(mergedTags), diff --git a/internal/plugins/inputs/elasticsearch/input.go b/internal/plugins/inputs/elasticsearch/input.go index d0889a766a..f5cd5a2dfe 100644 --- a/internal/plugins/inputs/elasticsearch/input.go +++ b/internal/plugins/inputs/elasticsearch/input.go @@ -523,6 +523,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.Log.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/iis/input.go b/internal/plugins/inputs/iis/input.go index 654e19af86..159a4c2ea0 100644 --- a/internal/plugins/inputs/iis/input.go +++ b/internal/plugins/inputs/iis/input.go @@ -83,6 +83,7 @@ func (ipt *Input) RunPipeline() { tailer.WithService("iis"), tailer.WithPipeline(ipt.Log.Pipeline), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/influxdb/input.go b/internal/plugins/inputs/influxdb/input.go index 0416635b75..469f7f9566 100644 --- a/internal/plugins/inputs/influxdb/input.go +++ b/internal/plugins/inputs/influxdb/input.go @@ -130,6 +130,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.Log.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/jenkins/input.go b/internal/plugins/inputs/jenkins/input.go index 6862ed740a..94d8b7b6d9 100644 --- a/internal/plugins/inputs/jenkins/input.go +++ b/internal/plugins/inputs/jenkins/input.go @@ -183,6 +183,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{`^\d{4}-\d{2}-\d{2}`}), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/kafka/input.go b/internal/plugins/inputs/kafka/input.go index a7b4a3c32c..776d23c12c 100644 --- a/internal/plugins/inputs/kafka/input.go +++ b/internal/plugins/inputs/kafka/input.go @@ -12,6 +12,7 @@ import ( "github.com/GuanceCloud/cliutils" "github.com/GuanceCloud/cliutils/logger" + "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/config" "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/datakit" "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/goroutine" "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/metrics" @@ -70,6 +71,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.Log.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.SemStop.Wait()), // nolint:typecheck } diff --git a/internal/plugins/inputs/logging/input.go b/internal/plugins/inputs/logging/input.go index 1b4abf63dc..dc70effed7 100644 --- a/internal/plugins/inputs/logging/input.go +++ b/internal/plugins/inputs/logging/input.go @@ -147,7 +147,7 @@ func (ipt *Input) Run() { tailer.WithSource(ipt.Source), tailer.WithService(ipt.Service), tailer.WithPipeline(ipt.Pipeline), - tailer.WithEnableDebugFields(config.Cfg.EnableDebugFields), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithSockets(ipt.Sockets), tailer.WithIgnoreStatus(ipt.IgnoreStatus), tailer.WithFromBeginning(ipt.FromBeginning), diff --git a/internal/plugins/inputs/mongodb/input.go b/internal/plugins/inputs/mongodb/input.go index 61ba300410..8480a389c4 100644 --- a/internal/plugins/inputs/mongodb/input.go +++ b/internal/plugins/inputs/mongodb/input.go @@ -16,6 +16,7 @@ import ( "github.com/GuanceCloud/cliutils" "github.com/GuanceCloud/cliutils/logger" "github.com/GuanceCloud/cliutils/point" + "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/config" "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/datakit" "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/goroutine" dkio "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/io" @@ -227,6 +228,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.MgoDBLog.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.MgoDBLog.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/mysql/input.go b/internal/plugins/inputs/mysql/input.go index bdaab84379..a8e9e54556 100644 --- a/internal/plugins/inputs/mysql/input.go +++ b/internal/plugins/inputs/mysql/input.go @@ -673,6 +673,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.Log.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } var err error diff --git a/internal/plugins/inputs/nginx/input.go b/internal/plugins/inputs/nginx/input.go index ea8cb80073..976ef0eee5 100644 --- a/internal/plugins/inputs/nginx/input.go +++ b/internal/plugins/inputs/nginx/input.go @@ -161,6 +161,7 @@ func (ipt *Input) RunPipeline() { tailer.WithService(inputName), tailer.WithPipeline(ipt.Log.Pipeline), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/postgresql/input.go b/internal/plugins/inputs/postgresql/input.go index 2a78882ac2..19dc2189dd 100644 --- a/internal/plugins/inputs/postgresql/input.go +++ b/internal/plugins/inputs/postgresql/input.go @@ -858,6 +858,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.Log.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/rabbitmq/input.go b/internal/plugins/inputs/rabbitmq/input.go index bf8fbee303..ea20a70175 100644 --- a/internal/plugins/inputs/rabbitmq/input.go +++ b/internal/plugins/inputs/rabbitmq/input.go @@ -73,6 +73,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.Log.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/redis/input.go b/internal/plugins/inputs/redis/input.go index cb42d9cfe8..806692406a 100644 --- a/internal/plugins/inputs/redis/input.go +++ b/internal/plugins/inputs/redis/input.go @@ -401,6 +401,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.Log.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/solr/input.go b/internal/plugins/inputs/solr/input.go index e79973d06e..c2be6440ba 100644 --- a/internal/plugins/inputs/solr/input.go +++ b/internal/plugins/inputs/solr/input.go @@ -150,6 +150,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{ipt.Log.MultilineMatch}), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/sqlserver/input.go b/internal/plugins/inputs/sqlserver/input.go index 5478a90801..c21ed74e71 100644 --- a/internal/plugins/inputs/sqlserver/input.go +++ b/internal/plugins/inputs/sqlserver/input.go @@ -354,6 +354,7 @@ func (ipt *Input) RunPipeline() { tailer.WithCharacterEncoding(ipt.Log.CharacterEncoding), tailer.WithMultilinePatterns([]string{`^\d{4}-\d{2}-\d{2}`}), tailer.WithGlobalTags(inputs.MergeTags(ipt.tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/plugins/inputs/tdengine/input.go b/internal/plugins/inputs/tdengine/input.go index 890349eae2..b158be63a0 100644 --- a/internal/plugins/inputs/tdengine/input.go +++ b/internal/plugins/inputs/tdengine/input.go @@ -13,6 +13,7 @@ import ( "github.com/GuanceCloud/cliutils" "github.com/GuanceCloud/cliutils/logger" + "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/config" "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/datakit" "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/goroutine" dkio "gitlab.jiagouyun.com/cloudcare-tools/datakit/internal/io" @@ -136,6 +137,7 @@ func (ipt *Input) RunPipeline() { tailer.WithService(inputName), tailer.WithPipeline(ipt.Pipeline), tailer.WithGlobalTags(inputs.MergeTags(ipt.Tagger.HostTags(), ipt.Tags, "")), + tailer.EnableDebugFields(config.Cfg.EnableDebugFields), tailer.WithDone(ipt.semStop.Wait()), } diff --git a/internal/tailer/option.go b/internal/tailer/option.go index 8cb444bc41..7d490fb790 100644 --- a/internal/tailer/option.go +++ b/internal/tailer/option.go @@ -72,7 +72,7 @@ func WithIgnoreStatus(arr []string) Option { return func(opt *option) { opt.ig func WithPipeline(s string) Option { return func(opt *option) { opt.pipeline = s } } func WithCharacterEncoding(s string) Option { return func(opt *option) { opt.characterEncoding = s } } func WithFromBeginning(b bool) Option { return func(opt *option) { opt.fromBeginning = b } } -func WithEnableDebugFields(b bool) Option { return func(opt *option) { opt.enableDebugFields = b } } +func EnableDebugFields(b bool) Option { return func(opt *option) { opt.enableDebugFields = b } } func WithTextParserMode(mode Mode) Option { return func(opt *option) { opt.mode = mode } } func WithSource(s string) Option {