gboolean cfg_init(GlobalConfig *cfg) { gint regerr; if (cfg->file_template_name && !(cfg->file_template = cfg_tree_lookup_template(&cfg->tree, cfg->file_template_name))) msg_error("Error resolving file template", evt_tag_str("name", cfg->file_template_name), NULL); if (cfg->proto_template_name && !(cfg->proto_template = cfg_tree_lookup_template(&cfg->tree, cfg->proto_template_name))) msg_error("Error resolving protocol template", evt_tag_str("name", cfg->proto_template_name), NULL); stats_reinit(cfg); if (cfg->bad_hostname_re) { if ((regerr = regcomp(&cfg->bad_hostname, cfg->bad_hostname_re, REG_NOSUB | REG_EXTENDED)) != 0) { gchar buf[256]; regerror(regerr, &cfg->bad_hostname, buf, sizeof(buf)); msg_error("Error compiling bad_hostname regexp", evt_tag_str("error", buf), NULL); } else { cfg->bad_hostname_compiled = TRUE; } } dns_cache_set_params(cfg->dns_cache_size, cfg->dns_cache_expire, cfg->dns_cache_expire_failed, cfg->dns_cache_hosts); return cfg_tree_start(&cfg->tree); }
gboolean cfg_init(GlobalConfig *cfg) { gint regerr; if (cfg->file_template_name && !(cfg->file_template = cfg_tree_lookup_template(&cfg->tree, cfg->file_template_name))) msg_error("Error resolving file template", evt_tag_str("name", cfg->file_template_name), NULL); if (cfg->proto_template_name && !(cfg->proto_template = cfg_tree_lookup_template(&cfg->tree, cfg->proto_template_name))) msg_error("Error resolving protocol template", evt_tag_str("name", cfg->proto_template_name), NULL); if (cfg->bad_hostname_re) { if ((regerr = regcomp(&cfg->bad_hostname, cfg->bad_hostname_re, REG_NOSUB | REG_EXTENDED)) != 0) { gchar buf[256]; regerror(regerr, &cfg->bad_hostname, buf, sizeof(buf)); msg_error("Error compiling bad_hostname regexp", evt_tag_str("error", buf), NULL); } else { cfg->bad_hostname_compiled = TRUE; } } if (!rcptid_init(cfg->state, cfg->use_uniqid)) return FALSE; stats_reinit(&cfg->stats_options); log_tags_reinit_stats(cfg); dns_caching_update_options(&cfg->dns_cache_options); hostname_reinit(cfg->custom_domain); host_resolve_options_init(&cfg->host_resolve_options, cfg); log_template_options_init(&cfg->template_options, cfg); if (!cfg_init_modules(cfg)) return FALSE; return cfg_tree_start(&cfg->tree); }