Commit 491420bb authored by qiuqunfeng's avatar qiuqunfeng
Browse files

Refactor WAF detection logic in LogConsumerService to restore functionality...

Refactor WAF detection logic in LogConsumerService to restore functionality for generating WAF detections and events. This update re-enables the processing of attacked logs and improves error handling, ensuring that failures during detection generation are logged for better visibility.
parent e07b0f18
......@@ -249,14 +249,14 @@ func (s *LogConsumerService) Handle(ctx context.Context, message []byte) error {
// WafDetections[i].WafDetectionAttackedLog = WafDetectionMessage.AttackedLog[i]
// WafDetections[i].WafDetectionAttackedLog.ID = id.Str()
// WafDetections[i].CreatedAt = WafDetectionMessage.CreatedAt
// wafDetection, err := s.genWafDetection(WafDetectionMessage, WafDetectionMessage.AttackedLog[i])
// if err != nil {
// log.Err(err).Str("message.Value", string(message)).Msg("gen waf detection fails")
// continue
// }
wafDetection, err := s.genWafDetection(WafDetectionMessage, WafDetectionMessage.AttackedLog[i])
if err != nil {
log.Err(err).Str("message.Value", string(message)).Msg("gen waf detection fails")
continue
}
// bulkIndexSignal := es.NewBulkIndexRequest().Index(EsIndexWafDetectionsAlias)
// bulkableRequests = append(bulkableRequests, bulkIndexSignal.Id(wafDetection.WafDetectionAttackedLog.ID).Doc(wafDetection))
bulkIndexSignal := es.NewBulkIndexRequest().Index(EsIndexWafDetectionsAlias)
bulkableRequests = append(bulkableRequests, bulkIndexSignal.Id(wafDetection.WafDetectionAttackedLog.ID).Doc(wafDetection))
event, err := s.genWafDetectionEvent(WafDetectionMessage, WafDetectionMessage.AttackedLog[i])
if err != nil {
......
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