Improved diagnostics in filters
This commit is contained in:
@ -170,30 +170,33 @@ int i;
|
||||
my_instance->source = NULL;
|
||||
my_instance->match = NULL;
|
||||
my_instance->nomatch = NULL;
|
||||
for (i = 0; params[i]; i++)
|
||||
if (params)
|
||||
{
|
||||
if (!strcmp(params[i]->name, "match"))
|
||||
for (i = 0; params[i]; i++)
|
||||
{
|
||||
my_instance->match = strdup(params[i]->value);
|
||||
}
|
||||
else if (!strcmp(params[i]->name, "exclude"))
|
||||
{
|
||||
my_instance->nomatch = strdup(params[i]->value);
|
||||
}
|
||||
else if (!strcmp(params[i]->name, "source"))
|
||||
my_instance->source = strdup(params[i]->value);
|
||||
else if (!strcmp(params[i]->name, "filebase"))
|
||||
{
|
||||
if (my_instance->filebase)
|
||||
free(my_instance->filebase);
|
||||
my_instance->source = strdup(params[i]->value);
|
||||
}
|
||||
else if (!filter_standard_parameter(params[i]->name))
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"qlafilter: Unexpected parameter '%s'.\n",
|
||||
params[i]->name)));
|
||||
if (!strcmp(params[i]->name, "match"))
|
||||
{
|
||||
my_instance->match = strdup(params[i]->value);
|
||||
}
|
||||
else if (!strcmp(params[i]->name, "exclude"))
|
||||
{
|
||||
my_instance->nomatch = strdup(params[i]->value);
|
||||
}
|
||||
else if (!strcmp(params[i]->name, "source"))
|
||||
my_instance->source = strdup(params[i]->value);
|
||||
else if (!strcmp(params[i]->name, "filebase"))
|
||||
{
|
||||
if (my_instance->filebase)
|
||||
free(my_instance->filebase);
|
||||
my_instance->source = strdup(params[i]->value);
|
||||
}
|
||||
else if (!filter_standard_parameter(params[i]->name))
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"qlafilter: Unexpected parameter '%s'.\n",
|
||||
params[i]->name)));
|
||||
}
|
||||
}
|
||||
}
|
||||
my_instance->sessions = 0;
|
||||
|
||||
@ -137,7 +137,7 @@ int i, cflags = REG_ICASE;
|
||||
my_instance->match = NULL;
|
||||
my_instance->replace = NULL;
|
||||
|
||||
for (i = 0; params[i]; i++)
|
||||
for (i = 0; params && params[i]; i++)
|
||||
{
|
||||
if (!strcmp(params[i]->name, "match"))
|
||||
my_instance->match = strdup(params[i]->value);
|
||||
@ -152,22 +152,25 @@ int i, cflags = REG_ICASE;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; options[i]; i++)
|
||||
if (options)
|
||||
{
|
||||
if (!strcasecmp(options[i], "ignorecase"))
|
||||
for (i = 0; options[i]; i++)
|
||||
{
|
||||
cflags |= REG_ICASE;
|
||||
}
|
||||
else if (!strcasecmp(options[i], "case"))
|
||||
{
|
||||
cflags &= ~REG_ICASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"regexfilter: unsupported option '%s'.\n",
|
||||
options[i])));
|
||||
if (!strcasecmp(options[i], "ignorecase"))
|
||||
{
|
||||
cflags |= REG_ICASE;
|
||||
}
|
||||
else if (!strcasecmp(options[i], "case"))
|
||||
{
|
||||
cflags &= ~REG_ICASE;
|
||||
}
|
||||
else
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(
|
||||
LOGFILE_ERROR,
|
||||
"regexfilter: unsupported option '%s'.\n",
|
||||
options[i])));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -183,7 +183,7 @@ TOPN_INSTANCE *my_instance;
|
||||
my_instance->exclude = NULL;
|
||||
my_instance->source = NULL;
|
||||
my_instance->filebase = strdup("top");
|
||||
for (i = 0; params[i]; i++)
|
||||
for (i = 0; params && params[i]; i++)
|
||||
{
|
||||
if (!strcmp(params[i]->name, "count"))
|
||||
my_instance->topN = atoi(params[i]->value);
|
||||
@ -210,6 +210,12 @@ TOPN_INSTANCE *my_instance;
|
||||
params[i]->name)));
|
||||
}
|
||||
}
|
||||
if (options)
|
||||
{
|
||||
LOGIF(LE, (skygw_log_write_flush(LOGFILE_ERROR,
|
||||
"topfilter: Options are not supported by this "
|
||||
" filter. They will be ignored\n")));
|
||||
}
|
||||
my_instance->sessions = 0;
|
||||
if (my_instance->match &&
|
||||
regcomp(&my_instance->re, my_instance->match, REG_ICASE))
|
||||
|
||||
Reference in New Issue
Block a user