]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Add configuration knobs for the errors circular buffer
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 Nov 2016 13:19:28 +0000 (13:19 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Mon, 14 Nov 2016 13:19:28 +0000 (13:19 +0000)
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c
src/libserver/cfg_utils.c

index 1980c1455c581722c0499912c39903cacb554cc3..1f31d372e97c282f93242fe34e6e26c8a15faee0 100644 (file)
@@ -326,6 +326,8 @@ struct rspamd_config {
        gboolean log_extended;                          /**< log extended information                                                   */
        gboolean log_systemd;                           /**< special case for systemd logger                                    */
        gboolean log_re_cache;                          /**< show statistics about regexps                                              */
+       guint log_error_elts;                           /**< number of elements in error logbuf                                 */
+       guint log_error_elt_maxlen;                     /**< maximum size of error log element                                  */
 
        gboolean mlock_statfile_pool;                   /**< use mlock (2) for locking statfiles                                */
 
index a260ca99a6d3593f80ec5d4a7f63402b47bbc7b8..8b6d6bfd4863887bb3dbf832844f25800e05b5d1 100644 (file)
@@ -1628,7 +1628,7 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
                        "log_buffer",
                        rspamd_rcl_parse_struct_integer,
                        G_STRUCT_OFFSET (struct rspamd_config, log_buf_size),
-                       0,
+                       RSPAMD_CL_FLAG_INT_32,
                        "Size of log buffer in bytes (for file logging)");
        rspamd_rcl_add_default_handler (sub,
                        "log_urls",
@@ -1698,6 +1698,18 @@ rspamd_rcl_config_init (struct rspamd_config *cfg)
                        G_STRUCT_OFFSET (struct rspamd_config, log_encryption_key),
                        0,
                        "Encrypt sensitive information in logs using this pubkey");
+       rspamd_rcl_add_default_handler (sub,
+                       "error_elts",
+                       rspamd_rcl_parse_struct_integer,
+                       G_STRUCT_OFFSET (struct rspamd_config, log_error_elts),
+                       RSPAMD_CL_FLAG_UINT,
+                       "Size of circular buffer for last errors (10 by default)");
+       rspamd_rcl_add_default_handler (sub,
+                       "error_maxlen",
+                       rspamd_rcl_parse_struct_integer,
+                       G_STRUCT_OFFSET (struct rspamd_config, log_error_elt_maxlen),
+                       RSPAMD_CL_FLAG_UINT,
+                       "Size of each element in error log buffer (1000 by default)");
        /**
         * Options section
         */
index 9daa90af8e4e701c9b9dd0482ee64132387d95ef..38aad8d6ccf043b7f6ffaaf7c1a55aa01014e032 100644 (file)
@@ -141,6 +141,8 @@ rspamd_config_new (void)
 
        cfg->dns_max_requests = 64;
        cfg->history_rows = 200;
+       cfg->log_error_elts = 10;
+       cfg->log_error_elt_maxlen = 1000;
 
        /* Default log line */
        cfg->log_format_str = "id: <$mid>,$if_qid{ qid: <$>,}$if_ip{ ip: $,}"