track the sigma rules
This commit is contained in:
@@ -2122,6 +2122,9 @@ func handlePipelineCallback(resp http.ResponseWriter, request *http.Request) {
|
|||||||
if err == nil {
|
if err == nil {
|
||||||
resp.WriteHeader(200)
|
resp.WriteHeader(200)
|
||||||
resp.Write([]byte(fmt.Sprintf(`{"success": true, "execution_id": "%s"}`, workflowExecution.ExecutionId)))
|
resp.Write([]byte(fmt.Sprintf(`{"success": true, "execution_id": "%s"}`, workflowExecution.ExecutionId)))
|
||||||
|
|
||||||
|
// Track Sigma rules
|
||||||
|
trackSigmaRules(ctx, pipeline.OrgId, jsonList)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2149,6 +2152,22 @@ func parseConcatenatedJSONLogs(logs string) ([]map[string]interface{}, error) {
|
|||||||
return jsonList, nil
|
return jsonList, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func trackSigmaRules(ctx context.Context, orgId string, jsonList []map[string]interface{}) {
|
||||||
|
ruleCount := make(map[string]int)
|
||||||
|
for _, logEntry := range jsonList {
|
||||||
|
if rule, ok := logEntry["rule"].(map[string]interface{}); ok {
|
||||||
|
if ruleName, ok := rule["title"].(string); ok {
|
||||||
|
ruleCount[ruleName]++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for ruleName, count := range ruleCount {
|
||||||
|
shuffle.IncrementCache(ctx, orgId, ruleName, count)
|
||||||
|
log.Printf("[INFO] Rule %s incremented by %d", ruleName, count)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func handleTenzirHealthUpdate(resp http.ResponseWriter, request *http.Request) {
|
func handleTenzirHealthUpdate(resp http.ResponseWriter, request *http.Request) {
|
||||||
if request.Method != "POST" {
|
if request.Method != "POST" {
|
||||||
request.Method = "POST"
|
request.Method = "POST"
|
||||||
|
|||||||
Reference in New Issue
Block a user