Logging from Ruby

For Ruby applications, in addition to raw HTTP ingestion, the semlogr gem and its Seq sink can be used to send structured log events efficiently to Seq.


In addition to the excellent support provided by semlogr, Seq can accept events from Ruby applications via UDP in the GELF format. This must be explicitly enabled using the instructions in Using GELF. See your preferred logging library's documentation for details of how to configure GELF logging.


Semlogr and its Seq sink can be installed from RubyGems:

gem install semlogr
gem install semlogr-sinks-seq

The logger configuration supports write_to :seq:

require 'semlogr'
require 'semlogr/sinks/seq'

Semlogr.logger = Semlogr.create_logger do |c|
  c.log_at :info

  c.write_to :seq, server_url: 'http://localhost:5341', api_key: 'xxxxxxxx'

The server_url should be the base URL of your Seq installation. An optional api_key is accepted.

Log events are written using message templates with named parameters:'Hello, {name}!', name: 'World')
Semlogr.error('API could not be contacted', error: err)

Events are sent to Seq asynchronously in batches.

More usage samples can be found in the Semlogr repository.

OpenTelemetry Ruby SDK

The OpenTelemetry Ruby SDK can send logs and traces to Seq. See Ingestion with OpenTelemetry and Tracing from OpenTelemetry for more information.