gboolean log_color; /**< output colors for console output */
gboolean log_extended; /**< log extended information */
gboolean log_systemd; /**< special case for systemd logger */
+ gboolean log_re_cache; /**< show statistics about regexps */
gboolean mlock_statfile_pool; /**< use mlock (2) for locking statfiles */
rspamd_rcl_parse_struct_boolean,
G_STRUCT_OFFSET (struct rspamd_config, log_urls),
0);
+ rspamd_rcl_add_default_handler (sub,
+ "log_re_cache",
+ rspamd_rcl_parse_struct_boolean,
+ G_STRUCT_OFFSET (struct rspamd_config, log_re_cache),
+ 0);
rspamd_rcl_add_default_handler (sub,
"debug_ip",
rspamd_rcl_parse_struct_string,
{
struct metric_result *metric_res;
GHashTableIter hiter;
+ const struct rspamd_re_cache_stat *restat;
gpointer h, v;
ucl_object_t *top = NULL;
gdouble required_score;
rspamd_task_write_log (task);
+ if (task->cfg->log_re_cache) {
+ restat = rspamd_re_cache_get_stat (task->re_rt);
+ g_assert (restat != NULL);
+ msg_info_task (
+ "regexp statistics: %ud pcre regexps scanned, %ud regexps matched,"
+ " %HL bytes scanned using pcre, %HL bytes scanned total",
+ restat->regexp_checked,
+ restat->regexp_matched,
+ restat->bytes_scanned_pcre,
+ restat->bytes_scanned);
+ }
+
msg->body = rspamd_fstring_sized_new (1000);
if (msg->method < HTTP_SYMBOLS && !RSPAMD_TASK_IS_SPAMC (task)) {