SDKs
Ruby SDK
Install the Logdash Ruby SDK, send your first log and your first metric.
Install the package, add your ingest key and the first log lands in the dashboard within a second. Everything below is copied from the Ruby SDK README.
Install
gem install logdash Initialise
Copy the ingest key from your domain's settings in Logdash and keep it in an environment variable. The key identifies the domain the data lands in, and app names the program that sends, such as api or worker. See Apps.
require 'logdash'
logdash_client = Logdash.create(api_key: ENV['LOGDASH_API_KEY'], app: "api")
logger = logdash_client[:logger]
metrics = logdash_client[:metrics] Send a log
logger.info('Application started successfully')
logger.error('An unexpected error occurred')
logger.warn('Low disk space warning') Send a metric
Metrics are named numbers. Set one to an absolute value or mutate it by a delta, and Logdash charts the history.
metrics.set('users', 0)
metrics.mutate('users', 1) Send an event
Events go to web analytics of the domain, next to the custom events of your website, with the same rules for names and properties.
events = logdash_client[:events]
events.track('agent_run', { agent: 'support', steps: 4, success: true }, user_id: current_user.id) Works with
- Ruby on Rails
- Sinatra
- Rack
- Sidekiq
FAQ
How do I wire it into Rails?
Create
config/initializers/logdash.rb, call Logdash.create inside ActiveSupport.on_load(:after_initialize) and assign $logger, $metrics and $events so they are available app-wide.What does Logdash.create return?
A hash. Read
client[:logger] for logging, client[:metrics] for counters and gauges and client[:events] for events.Which log levels does the logger expose?
info, error, warn, debug, verbose, http and silly.Copied from the ruby-sdk README at 4356af7 on 2026-11-09.