0.01
There's a lot of open issues
Better Stack Rails integration
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
 Dependencies

Development

Runtime

~> 0.1
>= 5.0.0
>= 5.0.0
>= 5.0.0
 Project Readme

Logtail - Ruby on Rails Logging Made Easy

Logtail ruby dashboard

ISC License Gem Version Build Status

Collect logs directly from your Ruby on Rails projects. To start logging Ruby projects explore the Logtail Ruby library.

Logtail is a hosted service that centralizes all of your logs into one place. Allowing for analysis, correlation and filtering with SQL. Actionable Grafana dashboards and collaboration come built-in. Logtail works with any language or platform and any data source.

Features

  • Simple integration.
  • Support for structured logging and events.
  • Automatically captures useful context.
  • Performant, light weight, with a thoughtful design.

Supported language versions

  • Ruby 2.5 or newer
  • Rails 5.0 or newer

Installation

Install the Logtail Ruby on Rails client library, run the following command:

bundle add logtail-rails

Alternatively, add gem "logtail-rails" to your Gemfile manually and then run bundle install.

Then add following configuration line into your config/application.rb:

module YourProject
  class Application < Rails::Application
    # ...
    # configuration of your project
    # ...

    config.logger = Logtail::Logger.create_default_logger("<SOURCE_TOKEN>")
  end
end

Don't forget to replace <SOURCE_TOKEN> with your actual source token which you can find by going to Better Stack Logs -> Source -> Edit.


Example project

To help you get started with using Logtail in your Ruby on Rails projects, we have prepared a simple program that showcases the usage of Logtail logger.

Download and install the example project

You can download the example project from GitHub directly or you can clone it to a select directory. Make sure you are in the projects directory and run the following command:

bundle install

This will install all dependencies listed in the Gemfile.lock file.

Then replace <SOURCE_TOKEN> in config/application.rb with your actual source token which you can find by going to Better Stack Logs -> Source -> Edit.

config.logger = Logtail::Logger.create_default_logger("<YOUR_ACTUAL_SOURCE_TOKEN>")

Run the example project

To run the example application, run the following command:

rails server

This will open a local server 127.0.0.1:3000. On the main page, click the "Let's go!" button to generate test logs.

You should see the following output:

All done!
Log into your Logtail account to check your logs.

This will create a total of 6 different logs, each corresponding to a different log level and one with additional structured data. You can review these logs in Logtail.

Explore how example project works

Learn how to setup Ruby logging by exploring the workings of the example project in detail.


Get in touch

Have any questions? Please explore the Better Stack documentation or contact our support.