Adds a negativ pattern as 3 paramter to the log item key.
only lines matching "positiv pattern" and not matching
"negativ pattern" are sent to the server.
this patch was created to further limit lines transmitted to the server.
Example Item Key
log[logfile<,positiv pattern><,negativ pattern>]
ZABBIX "BUG":
only lines matching "positiv pattern" and not matching
"negativ pattern" are sent to the server.
this patch was created to further limit lines transmitted to the server.
Example Item Key
log[logfile<,positiv pattern><,negativ pattern>]
ZABBIX "BUG":
Code:
## logfile-negativ-pattern.patch by <[email protected]> ## ## Adds a negativ pattern as 3 paramter to the log item. ## ## only lines matching "positiv pattern" and not matching ## "negativ pattern" are sent to the server. ## ## ## Example ## log[logfile<,positiv pattern><,negativ pattern>] ## diff -urNad zabbix-1.6.6~/src/zabbix_agent/active.c zabbix-1.6.6/src/zabbix_agent/active.c --- zabbix-1.6.6~/src/zabbix_agent/active.c 2009-08-26 15:16:24.000000000 +0200 +++ zabbix-1.6.6/src/zabbix_agent/active.c 2009-10-14 11:44:47.000000000 +0200 @@ -635,6 +635,7 @@ char params[MAX_STRING_LEN]; char filename[MAX_STRING_LEN]; char pattern[MAX_STRING_LEN]; + char pattern_exclude[MAX_STRING_LEN]; AGENT_RESULT result; @@ -656,7 +657,7 @@ if (parse_command(active_metrics[i].key, NULL, 0, params, MAX_STRING_LEN) != 2) break; - if (num_param(params) > 2) + if (num_param(params) > 3) break; if (get_param(params, 1, filename, sizeof(filename)) != 0) @@ -665,6 +666,9 @@ if (get_param(params, 2, pattern, sizeof(pattern)) != 0) *pattern = '\0'; + if (get_param(params, 3, pattern_exclude, sizeof(pattern_exclude)) != 0) + *pattern_exclude = '\0'; + s_count = 0; p_count = 0; lastlogsize = active_metrics[i].lastlogsize; @@ -673,7 +677,8 @@ break; if ('\0' == *pattern || NULL != zbx_regexp_match(value, pattern, NULL)) { - send_err = process_value( + if ('\0' == *pattern_exclude || NULL == zbx_regexp_match(value, pattern_exclude, NULL)) { + send_err = process_value( server, port, CONFIG_HOSTNAME, @@ -684,7 +689,8 @@ NULL, NULL ); - s_count++; + s_count++; + } } p_count++;