0

I am using a commercial Java app which writes it's logfiles using log4j. I'd like to get those logfile entries into Syslog where we have specific filters setup to trigger on system events.

Log4j doesn't have a direct way of passing it's output to syslog. two methods I've run across involve hacking the "catalina.sh" (whatever that entails; haven't looked yet) script and another is compiling a custom Java class to interface with log4j.

It seems like a simpler solution might be to symlink the log4j output file into a FIFO or pipe which would send the contents to syslogd listening on a network port (or netcat perhaps). Any thoughts on how to wire that up?

3

I'd recommend that you consider using logstash for this. It can consume text log files and pipe the log entries to a wide variety of other systems, including syslog.

You may be able to hack something together using netcat or the like, but using a purpose-built tool like logstash is going to be far better in the long run.

In addition to merely serving as a log transport, logstash can also munge log entries to add additional data (hostname, etc.) if needed.

| improve this answer | |
2

Your best best would be to set up your local syslog server to read the files and send them to your remote location. I've used syslog-ng, rsyslog and nxlog extensively for this. A quick look at google shows that syslogd should be able to do the same.

| improve this answer | |
  • Thanks for the heads up on this. I didn't know there was file montitoring capabilities in the syslog daemons. I'll come back to this if logstash doesn't work out. – Server Fault Jul 24 '15 at 20:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.