Beispiel #1
0
LogParser *
kv_parser_new(GlobalConfig *cfg, KVScanner *kv_scanner)
{
  KVParser *self = g_new0(KVParser, 1);

  log_parser_init_instance(&self->super, cfg);
  self->super.super.free_fn = kv_parser_free;
  self->super.super.clone = kv_parser_clone;
  self->super.process = kv_parser_process;

  self->kv_scanner = kv_scanner;
  self->formatted_key = g_string_sized_new(32);
  return &self->super;
}
Beispiel #2
0
__attribute__((visibility("hidden"))) LogParser*
native_parser_new(GlobalConfig *cfg)
{
  ParserNative *self = (ParserNative*) g_new0(ParserNative, 1);

  log_parser_init_instance(&self->super, cfg);
  self->native_object = native_parser_proxy_new(&self->super);

  if (!self->native_object)
    {
      g_free(self);
      return NULL;
    }

  __setup_callback_methods(self);

  return &self->super;
}
Beispiel #3
0
static LogPipe*
native_parser_clone(LogPipe *s)
{
  ParserNative *self = (ParserNative*) s;
  ParserNative *cloned;
  
  cloned = (ParserNative*) g_new0(ParserNative, 1);
  log_parser_init_instance(&cloned->super, s->cfg);
  cloned->native_object = native_parser_proxy_clone(self->native_object);
  assert(self != cloned);

  if (!cloned->native_object)
    {
      g_free(cloned);
      return NULL;
    }

  __setup_callback_methods(cloned);
  
  return &cloned->super.super; 
}
Beispiel #4
0
LogParser *
log_db_parser_new(void)
{
  LogDBParser *self = g_new0(LogDBParser, 1);

  log_parser_init_instance(&self->super);
  self->super.super.free_fn = log_db_parser_free;
  self->super.super.init = log_db_parser_init;
  self->super.super.deinit = log_db_parser_deinit;
  self->super.super.clone = log_db_parser_clone;
  self->super.process = log_db_parser_process;
  self->db_file = g_strdup(PATH_PATTERNDB_FILE);
  g_static_mutex_init(&self->lock);
  if (configuration && configuration->version < 0x0303)
    {
      msg_warning("WARNING: The default behaviour for injecting messages in db-parser() has changed in version 3.3 from internal to pass-through, use an explicit inject-mode(internal) option for old behaviour", NULL);
      self->inject_mode = LDBP_IM_INTERNAL;
    }
  else
    self->inject_mode = LDBP_IM_PASSTHROUGH;
  return &self->super;
}