I have a syslog-ng container that collects logs from other containers running on the same application, and normal logging works as intended: every container send its logs and syslog-ng saves them on separate files, as defined in syslog-ng.conf
.
I'm also trying to save error logs on a different file. I was assuming that everything thrown to STDERR from inside another container should be seen by syslog-ng as an error, so when I started a container like this:
docker run -dit --log-driver syslog --log-opt syslog-address=tcp://my_syslog:601 alpine echo "boom" > /dev/stderr
then I expected syslog-ng to understand it to be an error, but it does not.
This is an extract of my syslog-ng.conf
inside the syslog-ng container:
@version: 3.25
source s_net {
network(transport(tcp) port(601));
network(transport(udp) port(514));
};
destination d_error_file {
file("/tmp/errors");
};
filter f_errors {
level(err .. emerg);
};
log {
source(s_net);
filter(f_errors);
destination(d_error_file);
};
How can I tell syslog-ng to treat STDERR messages as errors?