Commit 4835dac7 authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Comment out WAF detection and event generation logic in LogConsumerService to...

Comment out WAF detection and event generation logic in LogConsumerService to simplify handling and improve readability. This change prepares the code for future enhancements while maintaining the current functionality.
parent 9d8c640a
......@@ -219,7 +219,7 @@ func (s *LogConsumerService) Handle(ctx context.Context, message []byte) error {
}
bulkableRequests := make([]es.BulkableRequest, 0)
WafDetections := make([]model.WafDetection, len(WafDetectionMessage.AttackedLog))
// WafDetections := make([]model.WafDetection, len(WafDetectionMessage.AttackedLog))
unPassCount := 0
for i := range WafDetectionMessage.AttackedLog {
......@@ -239,16 +239,16 @@ func (s *LogConsumerService) Handle(ctx context.Context, message []byte) error {
log.Err(err).Str("message.Value", string(message)).Msg("gen waf detection fails")
continue
}
WafDetections[i] = wafDetection
event, err := s.genWafDetectionEvent(WafDetectionMessage)
if err != nil {
log.Err(err).Str("message.Value", string(message)).Msg("gen waf detection event fails")
continue
}
// event, err := s.genWafDetectionEvent(WafDetectionMessage)
// if err != nil {
// log.Err(err).Str("message.Value", string(message)).Msg("gen waf detection event fails")
// continue
// }
bulkIndexSignal := es.NewBulkIndexRequest().Index(EsIndexWafDetectionsAlias)
bulkableRequests = append(bulkableRequests, bulkIndexSignal.Id(wafDetection.WafDetectionAttackedLog.ID).Doc(wafDetection))
bulkIndexEvent := es.NewBulkIndexRequest().Index(ESIndexEvents)
bulkableRequests = append(bulkableRequests, bulkIndexEvent.Id(event.ID).Doc(event))
// bulkIndexEvent := es.NewBulkIndexRequest().Index(ESIndexEvents)
// bulkableRequests = append(bulkableRequests, bulkIndexEvent.Id(event.ID).Doc(event))
}
s.esStore.Save(ctx, bulkableRequests)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment