[HOW TO] set application log to rsyslog on Ubuntu server

Depending on your application, also your purpose, you want to direct the log to fixed log path. So, if you are using rsyslog as a syslog service on Ubuntu, please follow this article.

I am using trigger to do this.

Go to log path
root@sta-tn:/etc/rsyslog.d#

then write a sub-rsyslog configuration.
root@sta-tn:/etc/rsyslog.d# vim 10-sta.conf 
if $programname == 'STA'  then {  
/var/log/sta.log    
stop 
}

You can declare more directive here. Then restart rsyslog service
root@sta-tn:/etc/rsyslog.d# systemctl restart rsyslog

Another way, you can use imfile module to do this.

Tiến Phan - R0039

Knowledge is Endless
Sharing for Success