[syslog-ng] syslog to java

JUNG, Christian christian.jung at saarstahl.com
Tue Mar 18 15:38:38 CET 2008


Hi Andrea,

in my opinion the best way would be to use the "program" destination. There you could call a java-application which reads the log from standard input and puts the messages in the java-based log system:

destination java_log_system {
	program("/path/to/java-connector" template("<$PRI>$DATE $HOST $MSG\n"));
};

log {
	source(src);
	destination(java_log_system);
};

With named pipes you've got the problem, that they won't block after the first read anymore (that's the way they behave under Linux). So your app would use a lot of CPU-cycles for nothing. 

syslog-ng will restart your app if it receives a HUP signal.


bye
Chris


-----Original Message-----
From: syslog-ng-bounces at lists.balabit.hu [mailto:syslog-ng-bounces at lists.balabit.hu]On Behalf Of Andrea Shore
Sent: Tuesday, March 18, 2008 3:21 PM
To: syslog-ng at lists.balabit.hu
Subject: [syslog-ng] syslog to java


Hi,
I've seen a lot of information on the web for logging from Log4j to syslog. I have a requirement to do the opposite; redirect syslog logs to a Java-based logging system. Does anyone have any ideas about how this could most effectively be accomplished? A production quality solution is required. Is a Java process reading from a named piped the best way to go about this?
Thanks a lot for your help,
Andrea


More information about the syslog-ng mailing list