Linux – Using Rsyslog to send application logs to syslog server

linuxrsyslog

I'm trying to setup my rsyslog to send logs generated by an application under /opt/appname/logs to a remote syslog server.
I have already configured rsyslog to send OS level logs but wanted to see if it can also send logs of an application.
I'm not sure if IncludeConfig directive works as it looks for another *.conf file.

Best Answer

rsyslog has support for reading from a file. This is done with the imfile module. You need the following config:

module(load="imfile" PollingInterval="10") #needs to be done just once

# needs to be done for each file you want to watch
input(type="imfile" File="/path/to/file1" 
     Tag="tag1" 
      StateFile="statefile1" 
      Severity="error" 
      Facility="local7")

There's more information at the rsyslog documentation site