Improved diagnostics in filters

This commit is contained in:
Mark Riddoch
2014-06-13 08:50:28 +01:00
parent 1868210a59
commit 480c842308
3 changed files with 50 additions and 38 deletions

View File

@ -170,6 +170,8 @@ int i;
my_instance->source = NULL;
my_instance->match = NULL;
my_instance->nomatch = NULL;
if (params)
{
for (i = 0; params[i]; i++)
{
if (!strcmp(params[i]->name, "match"))
@ -196,6 +198,7 @@ int i;
params[i]->name)));
}
}
}
my_instance->sessions = 0;
if (my_instance->match &&
regcomp(&my_instance->re, my_instance->match, REG_ICASE))

View File

@ -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,6 +152,8 @@ int i, cflags = REG_ICASE;
}
}
if (options)
{
for (i = 0; options[i]; i++)
{
if (!strcasecmp(options[i], "ignorecase"))
@ -170,6 +172,7 @@ int i, cflags = REG_ICASE;
options[i])));
}
}
}
if (my_instance->match == NULL || my_instance->replace == NULL)
{

View File

@ -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))