diff --git a/pluginmanager/plugin_runner_v1.go b/pluginmanager/plugin_runner_v1.go index 147109e947..a51921d94f 100644 --- a/pluginmanager/plugin_runner_v1.go +++ b/pluginmanager/plugin_runner_v1.go @@ -432,18 +432,26 @@ func (p *pluginv1Runner) ReceiveRawLog(log *pipeline.LogWithContext) { } func (p *pluginv1Runner) ReceiveLogGroup(logGroup pipeline.LogGroupWithContext) { - context := logGroup.Context topic := logGroup.LogGroup.GetTopic() - context[ctxKeyTopic] = topic for _, log := range logGroup.LogGroup.Logs { if len(topic) > 0 { log.Contents = append(log.Contents, &protocol.Log_Content{Key: tagKeyLogTopic, Value: topic}) } // When UsingOldContentTag is set to false, the tag is now put into the context during cgo. if !p.LogstoreConfig.GlobalConfig.UsingOldContentTag { + context := map[string]interface{}{} + for key, value := range logGroup.Context { + context[key] = value + } + context[ctxKeyTopic] = topic context[ctxKeyTags] = logGroup.LogGroup.LogTags p.ReceiveRawLog(&pipeline.LogWithContext{Log: log, Context: context}) } else { + context := map[string]interface{}{} + for key, value := range logGroup.Context { + context[key] = value + } + context[ctxKeyTopic] = topic for _, tag := range logGroup.LogGroup.LogTags { log.Contents = append(log.Contents, &protocol.Log_Content{ Key: tagPrefix + tag.GetKey(),