I would like to send logs of each application to a remote collector with syslog-ng.

If I have Apache, I'd like my Apache logs to be sent to my remote collector in the file /var/log/apache.log.

I couldn't find anything about this. I know it's possible with rsyslog but the only thing I'm able to do here is to send all the logs together with:

destination remote { network("<collector_adress>" transport("udp") port(514)); };

migrated from stackoverflow.com May 28 at 17:35

This question came from our site for professional and enthusiast programmers.


To collect logs from files with syslog-ng, you have to create file sources, and add them to a log statement. Something like this:

source s_apache {
log {
    source(s_apache); destination(remote);

To collect logs from other files as well, define additional sources and add them to the log statement. If you have an application that logs into several different log file (for example, into timestamped log files), you can use the wildcard-file source. Check the docs for details: https://www.syslog-ng.com/technical-documents/doc/syslog-ng-open-source-edition/3.21/administration-guide/16#TOPIC-1180423

Your Answer

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