add some detail info for log

This commit is contained in:
root
2024-10-28 09:25:46 +00:00
parent 816dabaf9e
commit abd00a9aab
2 changed files with 8 additions and 2 deletions

View File

@@ -156,9 +156,11 @@ static int expr_rule_pattern_count(struct expr_rule *rules, size_t n_rule,
for (size_t j = 0; j < rules[i].n_patterns; j++) { for (size_t j = 0; j < rules[i].n_patterns; j++) {
/* pat_len should not 0 */ /* pat_len should not 0 */
if (0 == rules[i].patterns[j].pat_len) { if (0 == rules[i].patterns[j].pat_len) {
char uuid_str[37];
uuid_unparse(rules[i].expr_uuid, uuid_str);
log_fatal(logger, MODULE_EXPR_MATCHER, log_fatal(logger, MODULE_EXPR_MATCHER,
"[%s:%d] expr pattern length should not 0", "[%s:%d] expr rule %s pattern length should not 0",
__FUNCTION__, __LINE__); __FUNCTION__, __LINE__, uuid_str);
return -1; return -1;
} }

View File

@@ -508,6 +508,10 @@ static int expr_keywords_to_expr_pattern(char *keywords, struct expr_pattern *pa
pattern->pat_len = pattern_len; pattern->pat_len = pattern_len;
} }
if (pattern->pat_len == 0) {
return -1;
}
return 0; return 0;
} }