char *log_file; /**< path to logfile in case of file logging */
int log_fd; /**< log descriptor in case of file logging */
FILE *logf;
+ gboolean log_urls; /**< whether we should log URLs */
size_t max_statfile_size; /**< maximum size for statfile */
console return LOG_TYPE_CONSOLE;
syslog return LOG_TYPE_SYSLOG;
file return LOG_TYPE_FILE;
+log_urls return LOG_URLS;
log_level return LOG_LEVEL;
DEBUG return LOG_LEVEL_DEBUG;
%token FILTERS FACTORS METRIC NAME CACHE_FILE
%token REQUIRED_SCORE REJECT_SCORE FUNCTION FRACT COMPOSITES CONTROL PASSWORD
%token LOGGING LOG_TYPE LOG_TYPE_CONSOLE LOG_TYPE_SYSLOG LOG_TYPE_FILE
-%token LOG_LEVEL LOG_LEVEL_DEBUG LOG_LEVEL_INFO LOG_LEVEL_WARNING LOG_LEVEL_ERROR LOG_FACILITY LOG_FILENAME
+%token LOG_LEVEL LOG_LEVEL_DEBUG LOG_LEVEL_INFO LOG_LEVEL_WARNING LOG_LEVEL_ERROR LOG_FACILITY LOG_FILENAME LOG_URLS
%token STATFILE ALIAS PATTERN WEIGHT STATFILE_POOL_SIZE SIZE TOKENIZER CLASSIFIER
%token DELIVERY LMTP ENABLED AGENT SECTION LUACODE RAW_MODE PROFILE_FILE COUNT
%token VIEW IP FROM SYMBOLS CLIENT_IP
| logginglevel
| loggingfacility
| loggingfile
+ | loggingurls
;
loggingtype:
}
;
+loggingurls:
+ LOG_URLS EQSIGN FLAG {
+ if ($3 != 0) {
+ cfg->log_urls = TRUE;
+ }
+ }
+ ;
classifier:
CLASSIFIER OBRACE classifierbody EBRACE {
static GList *custom_commands = NULL;
+/* For default metric, dirty hack, but much faster than hash lookup */
+static double default_score, default_required_score;
+
static char *
separate_command (f_str_t * in, char c)
{
cur = task->urls;
while (cur) {
url = cur->data;
+ if (task->cfg->log_urls) {
+ /* Write this url to log as well */
+ msg_info ("process_message: url found: <%s>, score: [%.2f / %.2f]", struri (url), default_score, default_required_score);
+ }
host.begin = url->host;
host.len = url->hostlen;
/* Skip long hosts to avoid protocol coollisions */
if (metric_name == NULL || metric_value == NULL) {
- m = g_hash_table_lookup (task->cfg->metrics, "default");
+ m = g_hash_table_lookup (task->cfg->metrics, DEFAULT_METRIC);
+ default_required_score = m->required_score;
+ default_score = 0;
if (!check_metric_settings (task, m, &ms, &rs)) {
ms = m->required_score;
rs = m->reject_score;
}
}
else {
+ /* XXX: dirty hack */
+ if (strcmp (metric_res->metric->name, DEFAULT_METRIC) == 0) {
+ default_required_score = metric_res->metric->required_score;
+ default_score = metric_res->score;
+ }
+
if (!check_metric_settings (task, metric_res->metric, &ms, &rs)) {
ms = metric_res->metric->required_score;
rs = metric_res->metric->reject_score;