damacus/ecs-logging-ruby

Transform your application logs to structured logs that comply with the Elastic Common Schema (ECS)

★ 0Forks 0RubyGitHub ↗Compare

README

ecs-logging-ruby

Gem

A set of libraries to transform your Ruby application logs to structured logs that comply with the Elastic Common Schema (ECS).

ECS logs are designed to be ingested by Elasticsearch via Filebeat or other collectors, and leveraged in Kibana.


Installation

Add this line to your application's Gemfile:

gem 'ecs-logging'

And then execute:

$ bundle install

Documentation

Full documentation is built with Zensical and available in the docs/ directory.

The docs are also published as a container image to GitHub Container Registry: ghcr.io/damacus/ecs-logging-ruby-docs:latest

Usage

Using the Logger directly

require 'ecs_logging/logger'

logger = EcsLogging::Logger.new($stdout)
logger.info("Hello world!")
# => {"@timestamp":"2021-02-09T12:00:00.000Z","log.level":"INFO","message":"Hello world!","ecs.version":"8.11.0"}

Using as Rack Middleware

require 'ecs_logging/middleware'

use EcsLogging::Middleware, $stdout

License

Apache 2.0

Contributors

reakaleekv1vbmorelli25damacuscolleenmcginnisgithub-actions[bot]obltmachineAlexanderWertelastic-observability-automation[bot]

Issues