{"id":22420454,"url":"https://github.com/meineerde/rackstash","last_synced_at":"2026-02-28T04:05:12.545Z","repository":{"id":136799597,"uuid":"79049565","full_name":"meineerde/rackstash","owner":"meineerde","description":"Structured logging for Ruby applications","archived":false,"fork":false,"pushed_at":"2025-02-27T00:02:03.000Z","size":614,"stargazers_count":3,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-27T04:43:42.342Z","etag":null,"topics":["graylog","logger","logging","logstash","rack","ruby"],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/meineerde.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-01-15T18:01:35.000Z","updated_at":"2025-02-27T00:02:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"19afe42b-03c8-44b7-bfbb-bed9f3e9c040","html_url":"https://github.com/meineerde/rackstash","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meineerde%2Frackstash","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meineerde%2Frackstash/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meineerde%2Frackstash/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/meineerde%2Frackstash/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/meineerde","download_url":"https://codeload.github.com/meineerde/rackstash/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248724490,"owners_count":21151557,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["graylog","logger","logging","logstash","rack","ruby"],"created_at":"2024-12-05T16:19:48.788Z","updated_at":"2026-02-28T04:05:07.508Z","avatar_url":"https://github.com/meineerde.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Rackstash\n\n[![Gem Version](https://badge.fury.io/rb/rackstash.svg)](https://rubygems.org/gems/rackstash)\n[![CI](https://github.com/meineerde/rackstash/workflows/CI/badge.svg)](https://github.com/meineerde/rackstash/actions?query=workflow%3ACI)\n[![Coverage Status](https://coveralls.io/repos/github/meineerde/rackstash/badge.svg?branch=master)](https://coveralls.io/github/meineerde/rackstash?branch=master)\n\n**Note: This gem is still work in progress. It is not yet usable and does not support any end-to-end logging. The good news is that we are working on that :)**\n\nRackstash is a Logger replacement for Ruby applications to allow flexible structured logging from request-based Ruby applications based on e.g [Rack](https://github.com/rack/rack), [Rails](http://rubyonrails.org/) or similar frameworks. It works best with a log receiver like [Logstash](https://www.elastic.co/products/logstash) or [Graylog](https://www.graylog.org).\n\nRackstash aims to provide a simple and clearly understood interface without too much magic. Being an infrastructure component of other apps, Rackstash aims to be extensible and adaptable towards novel use-cases.\n\nThis is the framework-agnostic base package with only minimal dependencies. There are several packages for framework-specifc integrations. If you use those, check out these gems:\n\n| Framework     | Gem |\n| ------------- | --- |\n| Ruby on Rails | [rackstash-rails](https://github.com/meineerde/rackstash-rails) |\n| Hanami        | [rackstash-hanami](https://github.com/meineerde/rackstash-hanami) |\n\n## Table of Contents\n\n* [Why Rackstash?](#why-rackstash)\n* [Installation](#installation)\n* [Usage](#usage)\n  - [Synopsis](#synopsis)\n\n## Why Rackstash\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'rackstash'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install rackstash\n\n## Usage\n\n* [Code Documentation](http://www.rubydoc.info/github/meineerde/rackstash/master)\n\n### Synopis\n\n```ruby\nrequire 'rackstash'\n\n# Create a new logger which writes its logs to the log/application.log file\n# The logger will write logs in Logstash's JSON format\nlogger = Rackstash::Logger.new('log/application.log')\n\n# With this buffer, you can log single messages to the logfile, one after\n# another. This works similar to a plain old Ruby logger. We support all\n# methods you'd expect from a logger.\nlogger.info 'Hello World'\n\n# You can create a new buffer using the with_buffer method. All log messages\n# you send within the block will be appended to the buffer and will be flushed\n# as a single log event only when you leave the block again.\n#\n# On each buffer, you can set (nested) fields and tags. These will be included\n# in the log event written to the log file.\nlogger.with_buffer do\n  logger.tag 'my_application'\n  logger['server'] = Socket.gethostname\n\n  logger.debug 'Starting request...'\n  logger.info  'Performing some work...'\n  logger.debug 'Done'\nend\n```\n\nWith the default JSON codec (you can chose another, see below) the emitted log events from the example above will look like this:\n\n```json\n{\"@version\":\"1\",\"@timestamp\":\"2016-12-07T13:37:13.370Z\",\"message\":\"Hello World\",\"tags\":[]}\n{\"server\":\"www.example.com\",\"@version\":\"1\",\"@timestamp\":\"2016-12-07T13:37:13.420Z\",\"message\":\"Starting request...\\nPerforming some work...\\nDone\",\"tags\":[\"my_application\"]}\n```\n\nAs you can see, we have written only two log events to our log file. The second event contains all three logged messages in the `\"message\"` field.\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/meineerde/rackstash. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](LICENSE.txt).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeineerde%2Frackstash","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmeineerde%2Frackstash","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmeineerde%2Frackstash/lists"}