Syslog Example

This example illustrates how to configure Jobly to send all logger events to a local or remote syslog.

Enabling syslog UDP connection

Note that for this to work, your syslog must be configured to accept UDP connections.

Edit /etc/rsyslog.conf and uncomment these lines:

# provides UDP syslog reception
module(load="imudp")
input(type="imudp" port="514")

Code

config/jobly.rb
jobs/hello.rb
Jobly.configure do |config|
# Log to local syslog and use the system name `jobly` and tag `demo`
config.log = "syslog://jobly:demo@127.0.0.1:514"
config.logger.level = Logger::INFO
end

Commands to Try

cd examples/syslog
# Install additional gem dependencies
bundle install
# Start watching the syslog
sudo tail -f /var/log/syslog
# Start both the server and the worker
foreman start
# Send jobs from the command line to the API
jobly send Hello