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@lists.balabit.hu [mailto:syslog-ng-bounces@lists.balabit.hu]On Behalf Of Andrea Shore Sent: Tuesday, March 18, 2008 3:21 PM To: syslog-ng@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
On Tue, 2008-03-18 at 15:38 +0100, JUNG, Christian wrote:
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.
I would use UNIX domain socket instead. Then your process is completely in its own control and not in syslog-ng's. -- Bazsi
I don't believe Java supports domain sockets since they are platform specific. On Tue, Mar 18, 2008 at 12:40 PM, Balazs Scheidler <bazsi@balabit.hu> wrote:
I would use UNIX domain socket instead. Then your process is completely in its own control and not in syslog-ng's.
-- Bazsi
______________________________________________________________________________ Member info: https://lists.balabit.hu/mailman/listinfo/syslog-ng Documentation: http://www.balabit.com/support/documentation/?product=syslog-ng FAQ: http://www.campin.net/syslog-ng/faq.html
participants (3)
-
Andrea Shore
-
Balazs Scheidler
-
JUNG, Christian