Lumberjack Redis Device
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.readInstallation
Add this line to your application's Gemfile:
gem "lumberjack_redis_device"And then execute:
$ bundleOr install it yourself as:
$ gem install lumberjack_redis_deviceContributing
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 redisLicense
The gem is available as open source under the terms of the MIT License.