I have written java application that runs on several hundred Linux computers. Program creates log file using log4j logger. To make development better I need to collect log files from these systems and make some analysis. What is the best way to get logging information from pc's and store them in one place? Some log files might appear zipped at the end of day while other logging information I would like see refreshed every hour or even more often.

How to solve my logging problem?

  • Not related to Unix/Linux, but have you considered using something like Logstash to aggregate log files? They have an input plugin for log4j... – h.j.k. Aug 21 '15 at 9:55

Instead of gathering log files, try to get logs directly: use syslog appender or socket appender. All logs will be directed to given single host where you can catch and do required analyze.


You could write an own logging class by deriving from AbstractLogger (provided by log4j). This class could log to a database. It would be useful to include the hostname of the computer to the log (and a timestamp of course).

Or you could use the database logging capabilities of log4j: http://www.tutorialspoint.com/log4j/log4j_logging_database.htm

  • In this case I will need to place database server on internet. Is that solution good from architecture point of view? – vico Aug 21 '15 at 10:24
  • Unfortunately, I am not an expert in software architecture. If it must work over the internet, maybe it is sufficient if you send the log files via email? – P3N9U1N Aug 21 '15 at 10:50
  • I made some research and it seems uncommon to expose a database server directly over the internet. But you could set up a webserver that provides a webservice which writes to the database. – P3N9U1N Aug 21 '15 at 11:19

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.