Skip to content

Commit

Permalink
移除多余 debug 字段且支持手动开启
Browse files Browse the repository at this point in the history
  • Loading branch information
liguozhuang authored and 谭彪 committed Oct 18, 2024
1 parent 0781de9 commit 4d7f465
Show file tree
Hide file tree
Showing 18 changed files with 21 additions and 3 deletions.
1 change: 1 addition & 0 deletions internal/plugins/inputs/apache/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
2 changes: 1 addition & 1 deletion internal/plugins/inputs/container/container_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/elasticsearch/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/iis/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/influxdb/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/jenkins/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
2 changes: 2 additions & 0 deletions internal/plugins/inputs/kafka/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion internal/plugins/inputs/logging/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 2 additions & 0 deletions internal/plugins/inputs/mongodb/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/mysql/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/nginx/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/postgresql/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/rabbitmq/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/redis/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/solr/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
1 change: 1 addition & 0 deletions internal/plugins/inputs/sqlserver/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()),
}

Expand Down
2 changes: 2 additions & 0 deletions internal/plugins/inputs/tdengine/input.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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()),
}

Expand Down
2 changes: 1 addition & 1 deletion internal/tailer/option.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 4d7f465

Please sign in to comment.