My Syslog-ng.conf file
The interesting part is the final flag which tells the syslog not to process any further the message. This way the message stays only in the rails application logfile.
log { source(src); filter(f_rails); destination(rails_log); flags(final); };
Here is the whole conf file
options {
chain_hostnames(off);
sync(0);dns_cache(2000);
dns_cache_expire(87600);
# The default action of syslog-ng 1.6.0 is to log a STATS line
# to the file every 10 minutes. That's pretty ugly after a while.
# Change it to every 12 hours so you get a nice daily update of
# how many messages syslog-ng missed (0).
stats(43200);
};
destination messages { file(“/var/log/messages”); };
# By default messages are logged to tty12…
# destination console_all { file(“/dev/tty12”); };
# …if you intend to use /dev/console for programs like xconsole
# you can comment out the destination line above that references /dev/tty12
# and uncomment the line below.
#destination console_all { file(“/dev/console”); };
source src {
unix-stream(“/dev/log” max-connections(256));
internal();
file(“/proc/kmsg”);
};
destination rails_log { file(“/var/log/system3.log”); };
filter f_rails { program(“rails.*”); };
log { source(src); filter(f_rails); destination(rails_log); flags(final); };
log { source(src); destination(messages); };
log { source(src); destination(console_all); };
On my last Debian Etch installation I have to commeted the “source src” and added just those lines
# we will use the default source configuration
#source src {
#unix-stream(“/dev/log” max-connections(256));
#internal();
#file(“/proc/kmsg”);
#};
destination rails_log { file(“/var/log/system3.log”); };
filter f_rails { program(“rails.*”); };
log { source(s_all); filter(f_rails); destination(rails_log); flags(final); };
Put this at the beginig of the log {} directives because we need want the final flag to take affect.
http://www.blueboxgrp.com/news/2009/06/unified_rails_logging_with_syslog-ng