In syslog-ng.conf I have the following:

source s_imp { tcp(ip("localhost") port(514)); }; filter f_imp {program("imp");}; destination d_imp {file("/home/rpr/syslog.log");}; log {source(s_imp); filter(f_imp); destination(d_imp);}; 

The output that I get in syslog.log is:

Apr 8 05:11:20 127.0.0.1 imp[4463]: message 

I'd like to log only the message and not the time stamp, IP address etc. Is there a way to do this?

1 Answer

This can be done with the help of templates. $MSG has the message contents and we can ensure that only it is logged.

template t_imp { template("$MSG\n"); template_escape(no); }; destination d_imp { file("/home/rpr/syslog.log" template(t_imp)); }; 

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

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