Пример #1
0
LogDriver *
perl_dd_new(GlobalConfig *cfg)
{
  PerlDestDriver *self = g_new0(PerlDestDriver, 1);

  log_threaded_dest_driver_init_instance(&self->super);

  self->super.super.super.super.init = perl_worker_init;
  self->super.super.super.super.free_fn = perl_dd_free;

  self->super.worker.thread_init = _perl_thread_init;
  self->super.worker.thread_deinit = _perl_thread_deinit;
  self->super.worker.disconnect = NULL;
  self->super.worker.insert = perl_worker_eval;

  self->super.format.stats_instance = perl_dd_format_stats_instance;
  self->super.format.persist_name = perl_dd_format_persist_name;
  self->super.stats_source = SCS_PERL;

  init_sequence_number(&self->seq_num);

  log_template_options_defaults(&self->template_options);
  perl_dd_set_value_pairs(&self->super.super.super, value_pairs_new_default(cfg));

  return (LogDriver *)self;
}
Пример #2
0
LogDriver *
afstomp_dd_new(GlobalConfig *cfg)
{
  STOMPDestDriver *self = g_new0(STOMPDestDriver, 1);

  log_threaded_dest_driver_init_instance(&self->super, cfg);
  self->super.super.super.super.init = afstomp_dd_init;
  self->super.super.super.super.free_fn = afstomp_dd_free;

  self->super.worker.thread_init = afstomp_worker_thread_init;
  self->super.worker.disconnect = afstomp_dd_disconnect;
  self->super.worker.insert = afstomp_worker_insert;

  self->super.format.stats_instance = afstomp_dd_format_stats_instance;
  self->super.format.persist_name = afstomp_dd_format_persist_name;
  self->super.stats_source = SCS_STOMP;

  afstomp_dd_set_host((LogDriver *) self, "127.0.0.1");
  afstomp_dd_set_port((LogDriver *) self, 61613);
  afstomp_dd_set_destination((LogDriver *) self, "/topic/syslog");
  afstomp_dd_set_persistent((LogDriver *) self, TRUE);
  afstomp_dd_set_ack((LogDriver *) self, FALSE);

  log_template_options_defaults(&self->template_options);
  afstomp_dd_set_value_pairs(&self->super.super.super, value_pairs_new_default(cfg));

  return (LogDriver *) self;
}
Пример #3
0
LogDriver *
redis_dd_new(GlobalConfig *cfg)
{
  RedisDriver *self = g_new0(RedisDriver, 1);

  log_threaded_dest_driver_init_instance(&self->super);
  self->super.super.super.super.init = redis_dd_init;
  self->super.super.super.super.free_fn = redis_dd_free;

  self->super.worker.thread_init = redis_worker_thread_init;
  self->super.worker.thread_deinit = redis_worker_thread_deinit;
  self->super.worker.disconnect = redis_dd_disconnect;
  self->super.worker.insert = redis_worker_insert;

  self->super.format.stats_instance = redis_dd_format_stats_instance;
  self->super.format.persist_name = redis_dd_format_persist_name;
  self->super.stats_source = SCS_REDIS;

  redis_dd_set_host((LogDriver *)self, "127.0.0.1");
  redis_dd_set_port((LogDriver *)self, 6379);

  self->command = g_string_sized_new(32);

  init_sequence_number(&self->seq_num);
  log_template_options_defaults(&self->template_options);

  return (LogDriver *)self;
}
Пример #4
0
LogDriver *
afmongodb_dd_new(GlobalConfig *cfg)
{
  MongoDBDestDriver *self = g_new0(MongoDBDestDriver, 1);

  mongo_util_oid_init (0);

  log_threaded_dest_driver_init_instance(&self->super);

  self->super.super.super.super.init = afmongodb_dd_init;
  self->super.super.super.super.free_fn = afmongodb_dd_free;
  self->super.queue_method = afmongodb_dd_queue_method;

  self->super.worker.thread_init = afmongodb_worker_thread_init;
  self->super.worker.thread_deinit = afmongodb_worker_thread_deinit;
  self->super.worker.disconnect = afmongodb_dd_disconnect;
  self->super.worker.insert = afmongodb_worker_insert;
  self->super.format.stats_instance = afmongodb_dd_format_stats_instance;
  self->super.format.persist_name = afmongodb_dd_format_persist_name;
  self->super.stats_source = SCS_MONGODB;

  afmongodb_dd_set_database((LogDriver *)self, "syslog");
  afmongodb_dd_set_collection((LogDriver *)self, "messages");
  afmongodb_dd_set_safe_mode((LogDriver *)self, FALSE);

  init_sequence_number(&self->seq_num);

  log_template_options_defaults(&self->template_options);
  afmongodb_dd_set_value_pairs(&self->super.super.super, value_pairs_new_default(cfg));

  return (LogDriver *)self;
}
Пример #5
0
GlobalConfig *
cfg_new(gint version)
{
  GlobalConfig *self = g_new0(GlobalConfig, 1);

  self->module_config = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, (GDestroyNotify) module_config_free);
  self->user_version = version;

  self->flush_lines = 100;
  self->flush_timeout = 10000;  /* 10 seconds */
  self->mark_freq = 1200;	/* 20 minutes */
  self->mark_mode = MM_HOST_IDLE;
  self->chain_hostnames = 0;
  self->time_reopen = 60;
  self->time_reap = 60;

  self->log_fifo_size = 10000;
  self->log_msg_size = 8192;

  self->file_uid = 0;
  self->file_gid = 0;
  self->file_perm = 0600;
  self->dir_uid = 0;
  self->dir_gid = 0;
  self->dir_perm = 0700;

  self->dns_cache_size = 1007;
  self->dns_cache_expire = 3600;
  self->dns_cache_expire_failed = 60;
  self->threaded = TRUE;
  self->pass_unix_credentials = TRUE;
  
  log_template_options_defaults(&self->template_options);
  self->template_options.ts_format = TS_FMT_BSD;
  self->template_options.frac_digits = 0;
  self->template_options.on_error = ON_ERROR_DROP_MESSAGE;

  host_resolve_options_defaults(&self->host_resolve_options);
  self->host_resolve_options.use_fqdn = FALSE;
  self->host_resolve_options.use_dns = TRUE;
  self->host_resolve_options.use_dns_cache = TRUE;
  self->host_resolve_options.normalize_hostnames = FALSE;

  self->recv_time_zone = NULL;
  self->keep_timestamp = TRUE;

  self->use_uniqid = FALSE;
  
  stats_options_defaults(&self->stats_options);

  cfg_tree_init_instance(&self->tree, self);
  cfg_register_builtin_plugins(self);
  return self;
}
Пример #6
0
void
log_macros_global_init(void)
{
  gint i;

  /* init the uptime (SYSUPTIME macro) */
  g_get_current_time(&app_uptime);
  log_template_options_defaults(&template_options_for_macro_expand);

  macro_hash = g_hash_table_new_full(g_str_hash, g_str_equal, g_free, NULL);
  for (i = 0; macros[i].name; i++)
    {
      g_hash_table_insert(macro_hash, g_strdup(macros[i].name),
                          GINT_TO_POINTER(macros[i].id));
    }
  return;
}
Пример #7
0
GlobalConfig *
cfg_new(gint version)
{
  GlobalConfig *self = g_new0(GlobalConfig, 1);

  self->user_version = version;

  self->flush_lines = 0;
  self->flush_timeout = 10000;  /* 10 seconds */
  self->mark_freq = 1200;	/* 20 minutes */
  self->mark_mode = MM_HOST_IDLE;
  self->stats_freq = 600;
  self->chain_hostnames = 0;
  self->use_fqdn = 0;
  self->use_dns = 1;
  self->time_reopen = 60;
  self->time_reap = 60;

  self->log_fifo_size = 10000;
  self->log_msg_size = 8192;

  self->follow_freq = -1;
  self->file_uid = 0;
  self->file_gid = 0;
  self->file_perm = 0600;
  self->dir_uid = 0;
  self->dir_gid = 0;
  self->dir_perm = 0700;

  self->use_dns_cache = 1;
  self->dns_cache_size = 1007;
  self->dns_cache_expire = 3600;
  self->dns_cache_expire_failed = 60;
  self->threaded = FALSE;
  
  log_template_options_defaults(&self->template_options);
  self->template_options.ts_format = TS_FMT_BSD;
  self->template_options.frac_digits = 0;
  self->recv_time_zone = NULL;
  self->keep_timestamp = TRUE;

  cfg_tree_init_instance(&self->tree, self);
  return self;
}
Пример #8
0
LogDriver *
afamqp_dd_new(GlobalConfig *cfg)
{
    AMQPDestDriver *self = g_new0(AMQPDestDriver, 1);

    log_threaded_dest_driver_init_instance(&self->super);

    self->super.super.super.super.init = afamqp_dd_init;
    self->super.super.super.super.free_fn = afamqp_dd_free;

    self->super.worker.thread_init = afamqp_worker_thread_init;
    self->super.worker.disconnect = afamqp_dd_disconnect;
    self->super.worker.insert = afamqp_worker_insert;

    self->super.format.stats_instance = afamqp_dd_format_stats_instance;
    self->super.format.persist_name = afamqp_dd_format_persist_name;
    self->super.stats_source = SCS_AMQP;

    self->routing_key_template = log_template_new(cfg, NULL);

    afamqp_dd_set_vhost((LogDriver *) self, "/");
    afamqp_dd_set_host((LogDriver *) self, "127.0.0.1");
    afamqp_dd_set_port((LogDriver *) self, 5672);
    afamqp_dd_set_exchange((LogDriver *) self, "syslog");
    afamqp_dd_set_exchange_type((LogDriver *) self, "fanout");
    afamqp_dd_set_routing_key((LogDriver *) self, "");
    afamqp_dd_set_persistent((LogDriver *) self, TRUE);
    afamqp_dd_set_exchange_declare((LogDriver *) self, FALSE);

    init_sequence_number(&self->seq_num);

    self->max_entries = 256;
    self->entries = g_new(amqp_table_entry_t, self->max_entries);

    log_template_options_defaults(&self->template_options);
    afamqp_dd_set_value_pairs(&self->super.super.super, value_pairs_new_default(cfg));

    return (LogDriver *) self;
}