Set up Loggly and Dokku with Rails, Logspout, and Syslog

author image
By Ben Radler

I recently launched a new Rails app on Digital Ocean using Dokku. I wanted to pipe out my Rails log data to Loggly, and found the documentation on this to be pretty sparse.

This should capture the steps I took to set it up. These steps assume you have a working Digital Ocean droplet with Dokku 0.7.1 or newer, and Rails 5 (though it should work fine with other frameworks that can log to syslog).

# SSH into your dokku box
dokku ssh

# install the logspout dokku plugin
dokku plugin:install

# For TLS:
dokku logspout:server syslog+tls://

# For non-encrypted:
dokku logspout:server syslog://

# optionally install dokku-hostname
# this sets the app name in loggly to your app, instead of docker container guids
dokku plugin:install dokku-hostname

# start logspout
dokku logspout:start

# if you have any errors starting, check the docker logs for hints
docker logs logspout

# rebuild your dokku containers
dokku ps:rebuildall

# see if the stream is working (hit a page in your rails app)
dokku logspout:info
dokku logspout:stream

Grab your customer token from Loggly at


# edit your logspout environment variables
vi /home/dokku/.logspout/ENV

# add your loggly customer token, replacing the < ... > 
SYSLOG_STRUCTURED_DATA=<loggly customer token>@41058

# restart logspout
dokku logspout:stop; dokku logspout:start

If all goes well, you should be able to hit a page in your Rails app and see the log data in Loggly live tail or dashboard.

Comment below if you have questions, comments, or problems setting it up yourself!

author image

Ben Radler

Ben is a Software Engineer. He works at Lyft in San Francisco, California.

© 2022 I love you.