]> source.dussan.org Git - rspamd.git/commitdiff
Add options to limit cores for rspamd
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 11 Dec 2015 16:48:52 +0000 (16:48 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Fri, 11 Dec 2015 16:48:52 +0000 (16:48 +0000)
doc/markdown/configuration/options.md
src/libserver/cfg_file.h
src/libserver/cfg_rcl.c

index 661b5ad6e126447b0e14a0c07b1bf86ddffe969b..fa7b24fec7c01d894d6ad1af287eaf15b82a4dc6 100644 (file)
@@ -50,6 +50,10 @@ symbol).
 * `classify_headers`: list of headers that are processed by statistics
 * `history_rows`: number of rows in the recent history roll table
 * `explicit_modules`: always load modules from the list even if they have no according configuration section in the file
+* `disable_hyperscan`: disable hyperscan optimizations (if enabled by compilation time)
+* `cores_dir`: directory where rspamd is intended to drop core files
+* `max_cores_size`: maximum total size of core files that are placed in `cores_dir`
+* `max_cores_count`: maximum number of files in `cores_dir`
 
 ## DNS options
 
@@ -75,4 +79,4 @@ options {
 
 ## Upstream options
 
-**TODO**
\ No newline at end of file
+**TODO**
index 3c2b14da05fc0c318ffba24ea56461e8a0ed1d2d..d145eaad46cccb3c11041a625c2445284943a2b9 100644 (file)
@@ -234,6 +234,9 @@ struct rspamd_config {
        gboolean disable_hyperscan;                     /**< disable hyperscan usage                                                    */
 
        gsize max_diff;                                 /**< maximum diff size for text parts                                   */
+       gsize max_cores_size;                           /**< maximum size occupied by rspamd core files                 */
+       gsize max_cores_count;                          /**< maximum number of core files                                               */
+       gchar *cores_dir;                               /**< directory for core files                                                   */
 
        enum rspamd_log_type log_type;                  /**< log type                                                                                   */
        gint log_facility;                              /**< log facility in case of syslog                                             */
index 751fa6964fd6ff6bb72ce1891717aec281e28019..f7a9a7be462e623fb78da70bd6dfc9264d26ad8c 100644 (file)
@@ -1470,6 +1470,21 @@ rspamd_rcl_config_init (void)
                        rspamd_rcl_parse_struct_boolean,
                        G_STRUCT_OFFSET (struct rspamd_config, disable_hyperscan),
                        0);
+       rspamd_rcl_add_default_handler (sub,
+                       "cores_dir",
+                       rspamd_rcl_parse_struct_string,
+                       G_STRUCT_OFFSET (struct rspamd_config, cores_dir),
+                       RSPAMD_CL_FLAG_STRING_PATH);
+       rspamd_rcl_add_default_handler (sub,
+                       "max_cores_size",
+                       rspamd_rcl_parse_struct_integer,
+                       G_STRUCT_OFFSET (struct rspamd_config, max_cores_size),
+                       RSPAMD_CL_FLAG_INT_SIZE);
+       rspamd_rcl_add_default_handler (sub,
+                       "max_cores_count",
+                       rspamd_rcl_parse_struct_integer,
+                       G_STRUCT_OFFSET (struct rspamd_config, max_cores_count),
+                       RSPAMD_CL_FLAG_INT_SIZE);
 
        /* New DNS configuration */
        ssub = rspamd_rcl_add_section (&sub->subsections, "dns", NULL, NULL,