Added extra logging to dbfwfilter output

The real username and host is now logged in addition to the user definition
that it matched. The messages also have the service name to distinct
connections to two different services which both use the same filter.
This commit is contained in:
Markus Makela
2016-02-17 10:45:21 +02:00
parent 47281d1c55
commit 497a72d42f

View File

@ -104,6 +104,7 @@ static char* required_rules[] =
"no_where_clause",
NULL
};
/*
* The filter entry points
*/
@ -2543,13 +2544,15 @@ routeQuery(FILTER *instance, void *session, GWBUF *queue)
len = MIN(len, FW_MAX_SQL_LEN);
if (match && my_instance->log_match & FW_LOG_MATCH)
{
MXS_NOTICE("Rule '%s' matched by '%s': %.*s", rname,
user->name, len, sql);
MXS_NOTICE("[%s] Rule '%s' for '%s' matched by %s@%s: %.*s",
dcb->service->name, rname, user->name,
dcb->user, dcb->remote, len, sql);
}
else if (!match && my_instance->log_match & FW_LOG_NO_MATCH)
{
MXS_NOTICE("Query by '%s' was not matched: %.*s",
user->name, len, sql);
MXS_NOTICE("[%s] Query for '%s' by %s@%s was not matched: %.*s",
dcb->service->name, user->name, dcb->user,
dcb->remote, len, sql);
}
}
}