[英]How to receive syslog messages and convert them to string
First I would like to receive the syslog message, the second I would like to syslog message into string type, please tell me how to write java code。 首先我想收到系统日志消息,其次我想将系统日志消息转换为字符串类型,请告诉我如何编写Java代码。
The following code can only be output in the console, how to get the string type of message. 以下代码只能在控制台中输出,如何获取消息的字符串类型。
SyslogServerEventHandlerIF eventHandler = new PrintStreamSyslogServerEventHandler(System.out);
SyslogServerIF serverIF = SyslogServer.getInstance("udp");
SyslogServerConfigIF config = serverIF.getConfig();
config.setHost("192.168.1.114");
config.setPort(10000);
config.addEventHandler(eventHandler);
serverIF.initialize("udp",config);
serverIF.run();
You can use Apache-camel for receiving messages over UDP and then unmarshal using syslog dataformat. 您可以使用Apache-camel通过UDP接收消息,然后使用syslog数据格式将其解组。 It supports both RFC3164 and RFC5424.
它同时支持RFC3164和RFC5424。 REFER : http://camel.apache.org/syslog.html
参考: http : //camel.apache.org/syslog.html
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.