Let say I have Nginx running inside a container (docker).
The access log and error logs are sent through STDOUT, in the Dockerfile :
# forward request and error logs to docker log collector
RUN ln -sf /dev/stdout /var/log/nginx/access.log
RUN ln -sf /dev/stderr /var/log/nginx/error.log
Logspout seems an elegant solution to send STDOUT of your container inside logstash (configured with a syslog input)
input {
syslog {
type => syslog
port => 5514
}
}
But logspout have no idea about the format of the log sent through STDOUT (Or am I missing something ?)
So do I have to do something like :
input {
syslog {
type => nginx-access
port => 5514
}
}
But then what about nginx error log ? And what if I send php-fpm log through STDOUT too ? How does logspout manage this ?
Another solution is to run rsyslog indose the container and send the collected logs to the input of logstatsh ...
As you can see it is not really clear for me ... I would like to be able to send nginx and php-fpm logs to logstash so they can be interpreted as what they are ... but I don't find a "good practice" ...
Can you help me please