I have installed logstash-forwarder
on a DigitalOcean Ubuntu droplet, along with my Rails app that I deploy with Capistrano. I know logstash-forwarder
is installed because I can do sudo service logstash-forwarder restart
.
I have configured logstash-forwarder
to read from stdin
with the following config:
{
"network": {
"servers": [ "<my logstash server>:5000" ],
"timeout": 15,
"ssl ca": "/etc/pki/tls/certs/logstash-forwarder.crt"
},
"files": [
{
"paths": [
"/var/log/syslog",
"/var/log/auth.log"
],
"fields": { "type": "syslog" }
}, {
"paths": [ "-" ],
"fields": { "type": "stdin" }
}
]
}
…and I have configured Rails to send all logs to stdout
instead of writing to disk. I’m not exactly sure where the logstash-forwarder
binary lives, and I’ve tried telling Capistrano to run the following command:
RBENV_ROOT=/usr/local/rbenv RBENV_VERSION=2.1.4 /usr/bin/env sudo /etc/init.d/unicorn_oddjob_production restart | /opt/logstash-forwarder/bin/logstash-forwarder
…But it fails with:
(Backtrace restricted to imported tasks)
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as deploy@128.199.40.124: sudo exit status: 127
sudo stdout: Nothing written
sudo stderr: bash: /opt/logstash-forwarder/bin/logstash-forwarder: No such file or directory
…
I’m quite new to all this, so I’m not sure where I’m going wrong. So, how can I send unicorn
’s stdout
to logstash-forwarder
’s stdin
?