Search code examples
javanginxsyslogrsyslog

How to receive nginx logs programmatically?


I want to display requests as they come in an nginx server to a java application.

Nginx can redirect access_log/error_log to syslog.

How can I receive syslog messages from Java ? Is there another way to receive the access_log and error_log from nginx to my java application ?


Solution

  • Try syslog4j? Alternatively there are any number of log shipping solutions e.g. logstash that might send the log to a store accessible by your Java app.