[syslog-ng] Is it possible to create Two instances of syslog-ng engine ?

Nitish Saboo nitish.saboo55 at gmail.com
Fri May 10 07:25:33 UTC 2019


Hi,

I have installed syslog-ng on my Linux box and I am planning you use
syslog-ng parser and wanted to initialise it's engine for parsing the data.

so initialise() method in my Go code calls  C code that is wrapper around
syslog-ng C header files. So ,I am making use of cgo.

Following is my Go code:

func (obj Syslogparser) initialise{

X := C.CString(obj.X)
defer C.free(unsafe.Pointer(X))
Y := C.CString(obj.Y)
defer C.free(unsafe.Pointer(Y))
C.initialize_engine(X, Y,
(C.key_value_cb)(unsafe.Pointer(C.callOnMeGo_cgo)));
}

And following is my C method 'initialize_engine':

int initialize_engine(const gchar* X, const gchar* Y, key_value_cb cb) //
cb is callback function
{
  module_path = _module_path;
  app_startup();
  msg_init(TRUE);

  configuration = cfg_new(0x0302);
  plugin_load_module("basicfuncs", configuration, NULL);
  plugin_load_module("syslogformat", configuration, NULL);

  pattern_db_global_init();

  if(patterndb != NULL){
    pattern_db_free(patterndb);
  }
  patterndb = pattern_db_new();
  pattern_db_reload_ruleset(patterndb, configuration, filename);
  pattern_db_set_emit_func(patterndb, pdbtool_pdb_emit_accumulate, cb);

  return 0;
}



My queries:

1)What is pattern_db_global_init, 'patterndb = pattern_db_new()',
'pattern_db_reload_ruleset', 'pattern_db_set_emit_func' doing in the
following case ?

2)Can I make two independent instances of syslog-ng engines?

3)How can I call two instances of syslog-ng engines independently from my
Go code?

Thanks
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.balabit.hu/pipermail/syslog-ng/attachments/20190510/a461e0b3/attachment.html>


More information about the syslog-ng mailing list