LogDriver * affile_sd_new(gchar *filename, GlobalConfig *cfg) { AFFileSourceDriver *self = affile_sd_new_instance(filename, cfg); self->file_open_options.is_pipe = FALSE; self->file_open_options.open_flags = DEFAULT_SD_OPEN_FLAGS; if (cfg_is_config_version_older(cfg, 0x0300)) { msg_warning_once("WARNING: file source: default value of follow_freq in file sources has changed in " VERSION_3_0 " to '1' for all files except /proc/kmsg", NULL); self->follow_freq = -1; } else { if (affile_is_device_node(filename) || affile_is_linux_proc_kmsg(filename)) self->follow_freq = 0; else self->follow_freq = 1000; } return &self->super.super; }
static void system_generate_cim_parser(GlobalConfig *cfg, GString *sysblock) { if (cfg_is_config_version_older(cfg, 0x0306)) { msg_warning_once("WARNING: Starting with " VERSION_3_6 ", the system() source performs JSON parsing of messages starting with the '@cim:' prefix. No additional action is needed", NULL); return; } if (!_is_json_parser_available(cfg)) { msg_debug("system(): json-parser() is missing, skipping the automatic JSON parsing of messages submitted via syslog(3), Please install the json module", NULL); return; } g_string_append(sysblock, "channel {\n" " channel {\n" " parser {\n" " json-parser(prefix('.cim.') marker('@cim:'));\n" " };\n" " flags(final);\n" " };\n" " channel { };\n" "};\n"); }
void afmongodb_dd_set_port(LogDriver *d, gint port) { MongoDBDestDriver *self = (MongoDBDestDriver *)d; msg_warning_once("WARNING: Using port() option is deprecated in mongodb driver, please use servers() instead", NULL); self->port = port; }
static gboolean log_matcher_posix_re_compile(LogMatcher *s, const gchar *re, GError **error) { LogMatcherPosixRe *self = (LogMatcherPosixRe *) s; gint rc; const gchar *re_comp = re; gint flags = REG_EXTENDED; g_return_val_if_fail(error == NULL || *error == NULL, FALSE); if (re[0] == '(' && re[1] == '?') { gint i; for (i = 2; re[i] && re[i] != ')'; i++) { if (re[i] == 'i') { /* deprecated */ msg_warning_once("WARNING: Your configuration file uses an obsoleted regexp option, please update your configuration", evt_tag_str("option", "(?i)"), evt_tag_str("change", "use ignore-case flag instead of (?i)"), NULL); flags |= REG_ICASE; } } if (re[i]) { re_comp = &re[i + 1]; } else { g_set_error(error, LOG_MATCHER_ERROR, 0, "missing closing parentheses in regexp flags"); return FALSE; } } if (self->super.flags & LMF_ICASE) flags |= REG_ICASE; if (self->super.flags & LMF_NEWLINE) flags |= REG_NEWLINE; if ((self->super.flags & (LMF_MATCH_ONLY + LMF_STORE_MATCHES)) == LMF_MATCH_ONLY) flags |= REG_NOSUB; rc = regcomp(&self->pattern, re_comp, flags); if (rc) { gchar buf[256]; regerror(rc, &self->pattern, buf, sizeof(buf)); g_set_error(error, LOG_MATCHER_ERROR, 0, "Error compiling regular expression: %s", buf); return FALSE; } return TRUE; }
void afmongodb_dd_set_host(LogDriver *d, const gchar *host) { MongoDBDestDriver *self = (MongoDBDestDriver *)d; msg_warning_once("WARNING: Using host() option is deprecated in mongodb driver, please use servers() instead", NULL); g_free(self->address); self->address = g_strdup(host); }
void log_reader_options_defaults(LogReaderOptions *options) { log_source_options_defaults(&options->super); log_proto_server_options_defaults(&options->proto_options.super); msg_format_options_defaults(&options->parse_options); options->fetch_limit = 10; if (configuration && cfg_is_config_version_older(configuration, 0x0300)) { msg_warning_once("WARNING: input: sources do not remove new-line characters from messages by default from " VERSION_3_0 ", please add 'no-multi-line' flag to your configuration if you want to retain this functionality", NULL); options->parse_options.flags |= LP_NO_MULTI_LINE; } }
void log_matcher_options_init(LogMatcherOptions *options, GlobalConfig *cfg) { if (!options->type) { const gchar *default_matcher = "pcre"; if (cfg_is_config_version_older(cfg, 0x0306)) { msg_warning_once("WARNING: syslog-ng changed the default regexp implementation to PCRE starting from " VERSION_3_6 ", please ensure your regexp works with PCRE or please specify type(\"posix\") in filters explicitly", NULL); default_matcher = "posix"; } if (!log_matcher_options_set_type(options, default_matcher)) g_assert_not_reached(); } }
static gboolean afunix_sd_adjust_reader_options(AFUnixSourceDriver *self, GlobalConfig *cfg) { self->super.reader_options.parse_options.flags |= LP_LOCAL; if (cfg_is_config_version_older(cfg, 0x0302)) { msg_warning_once("WARNING: the expected message format is being changed for unix-domain transports to improve " "syslogd compatibity with " VERSION_3_2 ". If you are using custom " "applications which bypass the syslog() API, you might " "need the 'expect-hostname' flag to get the old behaviour back", NULL); } else { self->super.reader_options.parse_options.flags &= ~LP_EXPECT_HOSTNAME; } return TRUE; }
LogMatcher * log_matcher_posix_re_new(const LogMatcherOptions *options) { LogMatcherPosixRe *self = g_new0(LogMatcherPosixRe, 1); log_matcher_init(&self->super, options); self->super.compile = log_matcher_posix_re_compile; self->super.match = log_matcher_posix_re_match; self->super.replace = log_matcher_posix_re_replace; self->super.free_fn = log_matcher_posix_re_free; if (configuration && cfg_is_config_version_older(configuration, 0x0300)) { msg_warning_once("WARNING: filters do not store matches in macros by default from " VERSION_3_0 ", please update your configuration by using an explicit 'store-matches' flag to achieve that", NULL); self->super.flags = LMF_STORE_MATCHES; } return &self->super; }
gboolean cfg_allow_config_dups(GlobalConfig *self) { const gchar *s; if (cfg_is_config_version_older(self, 0x0303)) return TRUE; s = cfg_args_get(self->lexer->globals, "allow-config-dups"); if (s && atoi(s)) { return TRUE; } else { /* duplicate found, but allow-config-dups is not enabled, hint the user that he might want to use allow-config-dups */ msg_warning_once("WARNING: Duplicate configuration objects (sources, destinations, ...) are not allowed by default starting with syslog-ng 3.3, add \"@define allow-config-dups 1\" to your configuration to reenable", NULL); return FALSE; } }
LogDriver * afpipe_sd_new(gchar *filename, GlobalConfig *cfg) { AFFileSourceDriver *self = affile_sd_new_instance(filename, cfg); self->file_open_options.is_pipe = TRUE; self->file_open_options.open_flags = DEFAULT_SD_OPEN_FLAGS_PIPE; if (cfg_is_config_version_older(cfg, 0x0302)) { msg_warning_once("WARNING: the expected message format is being changed for pipe() to improve " "syslogd compatibity with " VERSION_3_2 ". If you are using custom " "applications which bypass the syslog() API, you might " "need the 'expect-hostname' flag to get the old behaviour back", NULL); } else { self->reader_options.parse_options.flags &= ~LP_EXPECT_HOSTNAME; } return &self->super.super; }
gboolean log_matcher_options_set_type(LogMatcherOptions *options, const gchar *type) { LogMatcherConstructFunc construct; if (strcmp(type, "posix") == 0) { msg_warning_once("WARNING: syslog-ng dropped support for POSIX regexp implementations in " VERSION_3_14 " in favour of PCRE, which should be upward compatible. All 'posix' regexps are " "automatically switched to 'pcre'. Please ensure that your regexps work with PCRE and " "specify type('pcre') explicitly or increase @version to remove this warning"); type = "pcre"; } construct = log_matcher_lookup_construct(type); if (!construct) return FALSE; if (options->type) g_free(options->type); options->type = g_strdup(type); return TRUE; }