librelp example

This is the place for developers to discuss bugs, new features and everything else about code changes.

librelp example

Postby loggie on Wed Aug 13, 2008 4:27 pm

Hello.

Following your advice I'm trying to achieve pretty much the same goal: send set of messages reliably and secure to rsyslog.
reliable::
- using protocol with application-level acknowledgement
- network issues that code be auto-restored (like connection shutdown) transparently fixed
secure::
- using TLS tunnel for RELP protocol

The first question comes to my mind - how to actually use it?
Where can I find documentation for that library and some simple and not-so-simple examples of clients communicating with rsyslog?

Of course rsyslog source could serve as a reference by itself but something smaller and easier would be just great.
loggie
New
 
Posts: 7
Joined: Fri Jul 04, 2008 8:27 pm

Professional Services Information

  • Custom written rsyslog.conf?
  • Maintenance Contract?
  • Installation support?

Re: librelp example

Postby rgerhards on Wed Aug 13, 2008 4:31 pm

Side-Note: in a later release, relp will support TLS natively. But for now, you need to use stunnel, right :)

There is ample doc inside the source files (really ;)). But there are no good samples. However, rsyslog as a sample is not as bad as it may sound. Due to the plugin nature, things are quite easy. I suggest you have a look at imrelp/omrelp (inside ./plugins). And then ask again :) (but pls hurry a bit, I am about to leave for summer break...).

Rainer
User avatar
rgerhards
Site Admin
 
Posts: 1664
Joined: Thu Feb 13, 2003 11:57 am

Re: librelp example

Postby loggie on Wed Aug 13, 2008 11:51 pm

Thanks for quick answer.
I sniffed around omrelp.c from rsyslog - that's actually quite good reference code, only thing that makes it harder to follow the calling sequence is a lot of macros so I still have somethings to clarify:
As far as I understood librelp related callw alwayslies between followinf lines
relpEngineConstruct(&pRelpEngine)
relpEngineCltConstruct(pRelpEngine, &pData->pRelpClt);
...
relpEngineCltDestruct(pRelpEngine, &pData->pRelpClt);
relpEngineDestruct(&pRelpEngine)

Function relpEngineSetDbgprint() used for debug printing but I didn't really got how to use it for plain old stderr printing.

Following functions used to connect\reconnect to rsyslog:
relpCltConnect(pData->pRelpClt, glbl.GetDefPFFamily(), (uchar*) pData->port, (uchar*) pData->f_hname);
Looks pretty obvious except second parameter - what does it mean?
relpCltReconnect(pData->pRelpClt);
And what is librepl behavior if due to network outage connection were broken - should I check this manually and use reconnect() or there is a way to do it automatically?

After successful connection we use relpCltSendSyslog(pData->pRelpClt, (uchar*) pMsg, lenMsg); to send actual data.
The next question is - do I need to make well-formed message somehow or is it just any string less than 2k (is it default limit in rsyslog\relp?) And how do I set severity, facility, tag and other fancy stuff?

That's a lot already but I hope it might also help next guy who'll need to use librelp :-)
loggie
New
 
Posts: 7
Joined: Fri Jul 04, 2008 8:27 pm

Google Ads



Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 0 guests

cron