开发者

Standard interface for the C language for generating syslog messages

Which way is standard to generate IETF-syslog messages in the C language?

There is the header <syslog.h>. But it provide no options to use the STRUCTURED-DATA mechanism (rfc-5424).

Of course, messages could be constructed by hand开发者_开发技巧 directly to a socket. But it seems that such way is not standard.

Is there another standard way?


The standard way to do this is to have your application log messages using the normal openlog(), syslog() and closelog() routines from <syslog.h>.

That will send the messages to the syslogd running on the local machine. If the messages are then to be forwarded over the network using the syslog protocol, syslogd itself will take care of this. For example, this might be done using a target like @hostname in the syslogd.conf file.

In short, your application is expected to log messages to the syslogd, and syslogd decides where to send them (including over the network). This allows the local administrator maximum control.


Hmmm... that RFC is less than 2 years old. I don't think it is a big surprise to see that the ususal suspects haven't implemented it yet.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜