No release in over 3 years
A logging device for the lumberjack gem that writes log entries as JSON documentspec.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Development

Runtime

>= 0
 Project Readme

Lumberjack Redis Device

Continuous Integration Ruby Style Guide Gem Version

This is a simple reference implementation of a device for the lumberjack to send logs to a data store.

Warning

This gem is not intended for high volume production use. It is intended to be a simple way to expose a smallish volume of logs from a remote system via Redis.

In a high traffic system, the logs will roll over too quickly to be useful.

It can be useful as a temporary store in log shipment, or as a debug tool for seeing only recent log entries.

The number of entries in the list can be capped with the :limit paramter on the constructor. An expiration time can also be set on the redis key as well with the :ttl parameter.

# create a device to save to the app.log key in redis
# with a limit of 1000 entries that expires one hour after the last write.
device = Lumberjack::RedisDevice.new("app.log", redis: Redis.new, limit: 1000, ttl: 3600)

The log entries can then be read out again with the read method. The result will be an array of Lumberjack::LogEntry objects in the reverse order that they were written in (i.e. newest first).

entries = device.read

Installation

Add this line to your application's Gemfile:

gem "lumberjack_redis_device"

And then execute:

$ bundle

Or install it yourself as:

$ gem install lumberjack_redis_device

Contributing

Open a pull request on GitHub.

Please use the standardrb syntax and lint your code with standardrb --fix before submitting.

You'll need a redis server running to run the tests. You can spin one up using Docker:

$ docker run --rm -p 6379:6379 redis

License

The gem is available as open source under the terms of the MIT License.