Esempio n. 1
0
void
log_tags_global_deinit(void)
{
  gint i;

  g_static_mutex_lock(&log_tags_lock);

  g_hash_table_destroy(log_tags_hash);

  stats_lock();
  StatsClusterKey sc_key;
  for (i = 0; i < log_tags_num; i++)
    {
      stats_cluster_logpipe_key_set(&sc_key, SCS_TAG, log_tags_list[i].name, NULL );
      stats_unregister_counter(&sc_key, SC_TYPE_PROCESSED, &log_tags_list[i].counter);
      g_free(log_tags_list[i].name);
    }
  stats_unlock();

  log_tags_num = 0;
  g_free(log_tags_list);
  log_tags_list = NULL;
  log_tags_hash = NULL;

  g_static_mutex_unlock(&log_tags_lock);
}
Esempio n. 2
0
static gboolean
afmongodb_dd_deinit(LogPipe *s)
{
  MongoDBDestDriver *self = (MongoDBDestDriver *)s;

  afmongodb_dd_stop_thread(self);

  log_queue_set_counters(self->queue, NULL, NULL);
  stats_lock();
  stats_unregister_counter(SCS_MONGODB | SCS_DESTINATION, self->super.super.id,
			   afmongodb_dd_format_stats_instance(self),
			   SC_TYPE_STORED, &self->stored_messages);
  stats_unregister_counter(SCS_MONGODB | SCS_DESTINATION, self->super.super.id,
			   afmongodb_dd_format_stats_instance(self),
			   SC_TYPE_DROPPED, &self->dropped_messages);
  stats_unlock();
  if (!log_dest_driver_deinit_method(s))
    return FALSE;

  return TRUE;
}
Esempio n. 3
0
static gboolean
log_center_deinit(LogPipe *s, GlobalConfig *cfg, PersistentConfig *persist)
{
  LogCenter *self = (LogCenter *) s;
  
  self->cfg = cfg;
  self->persist = persist;
  self->success = TRUE;
  g_hash_table_foreach(cfg->sources, (GHFunc) log_center_deinit_component, self);
  if (!self->success)
    return FALSE;
  
  self->success = TRUE;
  g_hash_table_foreach(cfg->destinations, (GHFunc) log_center_deinit_component, self);
  if (!self->success)
    return FALSE;
  
  stats_unregister_counter(SC_TYPE_PROCESSED, "center(received)", &self->received_messages);
  stats_unregister_counter(SC_TYPE_PROCESSED, "center(queued)", &self->queued_messages);
  return TRUE;
}
Esempio n. 4
0
static gboolean
log_dest_group_deinit(LogPipe *s, GlobalConfig *cfg, PersistentConfig *persist)
{
  LogDestGroup *self = (LogDestGroup *) s;
  LogDriver *p;

  stats_unregister_counter(SC_TYPE_PROCESSED, log_dest_group_format_stats_name(self), &self->processed_messages);
  for (p = self->drivers; p; p = p->drv_next)
    {
      if (!p->super.deinit(&p->super, cfg, persist))
	return FALSE;
    }
  return TRUE;
}
Esempio n. 5
0
/*
 * NOTE: this is called at cfg_init() time to update the set of counters we
 * have.  If stats-level is decreased, we should unregister everything we
 * had earlier. If increased we need to register them again.
 *
 * log_tags_get_by_name() will also try to register the counter for calls
 * that are _after_ cfg_init().  Early calls to log_tags_get_by_name() will
 * not see a proper stats-level() in the global variable here.  Those will
 * get handled by this function.
 */
void
log_tags_reinit_stats(void)
{
  gint id;

  stats_lock();

  for (id = 0; id < log_tags_num; id++)
    {
      const gchar *name = log_tags_list[id].name;
      StatsClusterKey sc_key;
      stats_cluster_logpipe_key_set(&sc_key, SCS_TAG, name, NULL );

      if (stats_check_level(3))
        stats_register_counter(3, &sc_key, SC_TYPE_PROCESSED, &log_tags_list[id].counter);
      else
        stats_unregister_counter(&sc_key, SC_TYPE_PROCESSED, &log_tags_list[id].counter);
    }

  stats_unlock();
}
Esempio n. 6
0
static gboolean
log_source_group_deinit(LogPipe *s)
{
  LogSourceGroup *self = (LogSourceGroup *) s;
  LogDriver *p;
  gboolean success = TRUE;

  stats_unregister_counter(SCS_SOURCE | SCS_GROUP, self->name, NULL, SC_TYPE_PROCESSED, &self->processed_messages);
  for (p = self->drivers; p; p = p->drv_next)
    {
      if (!log_pipe_deinit(&p->super))
        {
          msg_error("Error deinitializing source driver",
                    evt_tag_str("source", self->name),
                    evt_tag_str("id", p->id),
                    NULL);
          success = FALSE;
	}
    }
  return success;
}
Esempio n. 7
0
void
log_tags_deinit(void)
{
  gint i;

  g_static_mutex_lock(&log_tags_lock);

  g_hash_table_destroy(log_tags_hash);

  stats_lock();
  for (i = 0; i < log_tags_num; i++)
    {
      stats_unregister_counter(SCS_TAG, log_tags_list[i].name, NULL, SC_TYPE_PROCESSED, &log_tags_list[i].counter);
      g_free(log_tags_list[i].name);
    }
  stats_unlock();

  log_tags_num = 0;
  g_free(log_tags_list);
  log_tags_list = NULL;
  log_tags_hash = NULL;

  g_static_mutex_unlock(&log_tags_lock);
}