void afsocket_sd_init_instance(AFSocketSourceDriver *self, SocketOptions *socket_options, TransportMapper *transport_mapper) { log_src_driver_init_instance(&self->super); self->super.super.super.init = afsocket_sd_init_method; self->super.super.super.deinit = afsocket_sd_deinit_method; self->super.super.super.free_fn = afsocket_sd_free_method; /* NULL behaves as if log_pipe_forward_msg was specified */ self->super.super.super.queue = NULL; self->super.super.super.notify = afsocket_sd_notify; self->construct_transport = afsocket_sd_construct_transport_method; self->setup_addresses = afsocket_sd_setup_addresses_method; self->socket_options = socket_options; self->transport_mapper = transport_mapper; self->max_connections = 10; self->listen_backlog = 255; self->connections_kept_alive_accross_reloads = TRUE; log_reader_options_defaults(&self->reader_options); /* NOTE: this changes the initial window size from 100 to 1000. Reasons: * Starting with syslog-ng 3.3, window-size is distributed evenly between * _all_ possible connections to avoid starving. With the defaults this * means that we get a window size of 10 messages log_iw_size(100) / * max_connections(10), but that is incredibly slow, thus bump this value here. */ self->reader_options.super.init_window_size = 1000; }
LogDriver * afstreams_sd_new(gchar *filename) { LogDriver *self = g_new0(LogDriver, 1); log_src_driver_init_instance(self); self->super.init = afstreams_sd_dummy_init; self->super.deinit = afstreams_sd_dummy_deinit; self->super.free_fn = log_src_driver_free; return self; }
LogDriver * systemd_journal_sd_new(GlobalConfig *cfg) { SystemdJournalSourceDriver *self = g_new0(SystemdJournalSourceDriver, 1); log_src_driver_init_instance(&self->super, cfg); self->super.super.super.init = __init; self->super.super.super.deinit = __deinit; self->super.super.super.free_fn = __free; journal_reader_options_defaults(&self->reader_options); self->journald = journald_new(); return &self->super.super; }
LogDriver * afinter_sd_new(void) { AFInterSourceDriver *self = g_new0(AFInterSourceDriver, 1); log_src_driver_init_instance((LogSrcDriver *)&self->super); self->super.super.init = afinter_sd_init; self->super.super.deinit = afinter_sd_deinit; self->super.super.free_fn = afinter_sd_free; log_source_options_defaults(&self->source_options); return (LogDriver *)&self->super.super; }
LogDriver * trigger_sd_new (GlobalConfig *cfg) { TriggerSourceDriver *self = g_new0 (TriggerSourceDriver, 1); log_src_driver_init_instance ((LogSrcDriver *)&self->super, cfg); self->super.super.super.init = trigger_sd_init; self->super.super.super.deinit = trigger_sd_deinit; log_source_options_defaults (&self->source_options); return (LogDriver *)self; }
LogDriver * afprogram_sd_new(gchar *cmdline) { AFProgramSourceDriver *self = g_new0(AFProgramSourceDriver, 1); log_src_driver_init_instance(&self->super); self->super.super.super.init = afprogram_sd_init; self->super.super.super.deinit = afprogram_sd_deinit; self->super.super.super.free_fn = afprogram_sd_free; self->super.super.super.notify = afprogram_sd_notify; self->cmdline = g_string_new(cmdline); log_reader_options_defaults(&self->reader_options); self->reader_options.parse_options.flags |= LP_LOCAL; return &self->super.super; }
LogDriver * afstreams_sd_new(gchar *filename, GlobalConfig *cfg) { AFStreamsSourceDriver *self = g_new0(AFStreamsSourceDriver, 1); log_src_driver_init_instance(&self->super, cfg); self->dev_filename = g_string_new(filename); self->super.super.super.init = afstreams_sd_init; self->super.super.super.deinit = afstreams_sd_deinit; self->super.super.super.free_fn = afstreams_sd_free; log_reader_options_defaults(&self->reader_options); self->reader_options.parse_options.flags |= LP_LOCAL; self->reader_options.parse_options.flags &= ~LP_EXPECT_HOSTNAME; return &self->super.super; }
LogDriver * afprogram_sd_new(gchar *cmdline, GlobalConfig *cfg) { AFProgramSourceDriver *self = g_new0(AFProgramSourceDriver, 1); log_src_driver_init_instance(&self->super, cfg); self->super.super.super.init = afprogram_sd_init; self->super.super.super.deinit = afprogram_sd_deinit; self->super.super.super.free_fn = afprogram_sd_free; self->super.super.super.notify = afprogram_sd_notify; self->process_info.cmdline = g_string_new(cmdline); afprogram_set_inherit_environment(&self->process_info, TRUE); log_reader_options_defaults(&self->reader_options); self->reader_options.parse_options.flags |= LP_LOCAL; return &self->super.super; }
void afsocket_sd_init_instance(AFSocketSourceDriver *self, SocketOptions *sock_options, gint family, guint32 flags) { log_src_driver_init_instance(&self->super); self->super.super.super.init = afsocket_sd_init; self->super.super.super.deinit = afsocket_sd_deinit; self->super.super.super.free_fn = afsocket_sd_free; /* NULL behaves as if log_pipe_forward_msg was specified */ self->super.super.super.queue = NULL; self->super.super.super.notify = afsocket_sd_notify; self->sock_options_ptr = sock_options; self->setup_socket = afsocket_sd_setup_socket; self->address_family = family; self->max_connections = 10; self->listen_backlog = 255; self->flags = flags | AFSOCKET_KEEP_ALIVE; log_reader_options_defaults(&self->reader_options); if (self->flags & AFSOCKET_STREAM) self->reader_options.super.init_window_size = 1000; if (self->flags & AFSOCKET_LOCAL) { static gboolean warned = FALSE; self->reader_options.parse_options.flags |= LP_LOCAL; if (configuration && configuration->version < 0x0302) { if (!warned) { msg_warning("WARNING: the expected message format is being changed for unix-domain transports to improve " "syslogd compatibity with syslog-ng 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); warned = TRUE; } } else { self->reader_options.parse_options.flags &= ~LP_EXPECT_HOSTNAME; } } if ((self->flags & AFSOCKET_SYSLOG_PROTOCOL)) { self->reader_options.parse_options.flags |= LP_SYSLOG_PROTOCOL; } }
static AFFileSourceDriver * affile_sd_new_instance(gchar *filename, GlobalConfig *cfg) { AFFileSourceDriver *self = g_new0(AFFileSourceDriver, 1); log_src_driver_init_instance(&self->super, cfg); self->filename = g_string_new(filename); self->super.super.super.init = affile_sd_init; self->super.super.super.queue = affile_sd_queue; self->super.super.super.deinit = affile_sd_deinit; self->super.super.super.notify = affile_sd_notify; self->super.super.super.free_fn = affile_sd_free; log_reader_options_defaults(&self->reader_options); file_perm_options_defaults(&self->file_perm_options); self->reader_options.parse_options.flags |= LP_LOCAL; if (affile_is_linux_proc_kmsg(filename)) self->file_open_options.needs_privileges = TRUE; return self; }
LogDriver * affile_sd_new(gchar *filename, guint32 flags) { AFFileSourceDriver *self = g_new0(AFFileSourceDriver, 1); log_src_driver_init_instance(&self->super); self->filename = g_string_new(filename); self->flags = flags; self->super.super.super.init = affile_sd_init; self->super.super.super.queue = affile_sd_queue; self->super.super.super.deinit = affile_sd_deinit; self->super.super.super.notify = affile_sd_notify; self->super.super.super.free_fn = affile_sd_free; log_reader_options_defaults(&self->reader_options); self->reader_options.parse_options.flags |= LP_LOCAL; if ((self->flags & AFFILE_PIPE)) { static gboolean warned = FALSE; if (configuration && configuration->version < 0x0302) { if (!warned) { msg_warning("WARNING: the expected message format is being changed for pipe() to improve " "syslogd compatibity with syslog-ng 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); warned = TRUE; } } else { self->reader_options.parse_options.flags &= ~LP_EXPECT_HOSTNAME; } } if (configuration && configuration->version < 0x0300) { static gboolean warned = FALSE; if (!warned) { msg_warning("WARNING: file source: default value of follow_freq in file sources is changing in 3.0 to '1' for all files except /proc/kmsg", NULL); warned = TRUE; } } else { if ((self->flags & AFFILE_PIPE) == 0) { if (0 || #if __linux__ (strcmp(filename, "/proc/kmsg") == 0) || #elif __FreeBSD__ (strcmp(filename, "/dev/klog") == 0) || #endif 0) { self->reader_options.follow_freq = 0; } else { self->reader_options.follow_freq = 1000; } } } #if __linux__ if (strcmp(filename, "/proc/kmsg") == 0) { self->flags |= AFFILE_PRIVILEGED; } #endif return &self->super.super; }