{"id":32929218,"url":"https://github.com/amkisko/grape_rails_logger.rb","last_synced_at":"2026-04-15T20:33:13.155Z","repository":{"id":322628964,"uuid":"1089564799","full_name":"amkisko/grape_rails_logger.rb","owner":"amkisko","description":"Unified, Rails-compatible JSON request logging for Grape APIs with ActiveRecord timing, parameter filtering, and structured context.","archived":false,"fork":false,"pushed_at":"2026-02-10T15:08:21.000Z","size":179,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-10T19:52:50.042Z","etag":null,"topics":["activerecord","grape","logging","monitoring","rails","security","structured-logging"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/grape_rails_logger","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/amkisko.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"amkisko"}},"created_at":"2025-11-04T14:11:44.000Z","updated_at":"2026-02-10T15:08:53.000Z","dependencies_parsed_at":null,"dependency_job_id":"f574d527-34eb-4a5e-8292-cc1359f61e9d","html_url":"https://github.com/amkisko/grape_rails_logger.rb","commit_stats":null,"previous_names":["amkisko/grape-rails-logger.rb","amkisko/grape_rails_logger.rb"],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/amkisko/grape_rails_logger.rb","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amkisko%2Fgrape_rails_logger.rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amkisko%2Fgrape_rails_logger.rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amkisko%2Fgrape_rails_logger.rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amkisko%2Fgrape_rails_logger.rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amkisko","download_url":"https://codeload.github.com/amkisko/grape_rails_logger.rb/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amkisko%2Fgrape_rails_logger.rb/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31859472,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-15T15:24:51.572Z","status":"ssl_error","status_checked_at":"2026-04-15T15:24:39.138Z","response_time":63,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["activerecord","grape","logging","monitoring","rails","security","structured-logging"],"created_at":"2025-11-11T11:17:01.704Z","updated_at":"2026-04-15T20:33:13.151Z","avatar_url":"https://github.com/amkisko.png","language":"Ruby","funding_links":["https://github.com/sponsors/amkisko"],"categories":[],"sub_categories":[],"readme":"# grape_rails_logger\n\n[![Gem Version](https://badge.fury.io/rb/grape_rails_logger.svg?v=1.1.0)](https://badge.fury.io/rb/grape_rails_logger) [![Test Status](https://github.com/amkisko/grape_rails_logger.rb/actions/workflows/test.yml/badge.svg)](https://github.com/amkisko/grape_rails_logger.rb/actions/workflows/test.yml) [![codecov](https://codecov.io/gh/amkisko/grape_rails_logger.rb/graph/badge.svg?token=RC5T0Y2Z5A)](https://codecov.io/gh/amkisko/grape_rails_logger.rb)\n\nRails-compatible structured logging for Grape APIs with ActiveRecord timing, parameter filtering, and exception tracking.\n\nSponsored by [Kisko Labs](https://www.kiskolabs.com).\n\n\u003ca href=\"https://www.kiskolabs.com\"\u003e\n  \u003cimg src=\"kisko.svg\" width=\"200\" alt=\"Sponsored by Kisko Labs\" /\u003e\n\u003c/a\u003e\n\n## Installation\n\nAdd to your Gemfile:\n\n```ruby\ngem \"grape_rails_logger\"\n```\n\nRun `bundle install` or `gem install grape_rails_logger`.\n\n## Usage\n\nThe gem works automatically in Rails applications. No configuration needed. It automatically patches `Grape::Endpoint#build_stack` to instrument requests and subscribes to `grape.request` notifications, logging structured data via `Rails.logger`. Works with any Rails logger or integrates with `activesupport-json_logging` for JSON output.\n\n## What gets logged\n\nEach request logs structured data with:\n- Request metadata: `method`, `path`, `status`, `duration`, `host`, `remote_addr`, `request_id`\n- Route information: `controller`, `action`, `source_location` (file:line)\n- Performance metrics: `duration` (ms), `db` (ActiveRecord query time in ms), `db_calls` (SQL query count)\n- Parameters: `params` (automatically filtered using Rails `filter_parameters`)\n- Exceptions: `exception` object with `class`, `message`, and `backtrace` (non-production only)\n\n## Configuration\n\nConfigure parameter filtering in `config/initializers/filter_parameter_logging.rb`:\n\n```ruby\nRails.application.config.filter_parameters += [\n  :passw, :secret, :token, :_key, :crypt, :salt, :certificate, :otp, :ssn\n]\n```\n\nWhen Rails `ParameterFilter` is not available, the gem falls back to manual filtering that detects sensitive patterns (password, secret, token, key) in parameter keys.\n\n## Debug tracing\n\nOptional `DebugTracer` middleware provides detailed request tracing when the `debug` gem is installed and `TRACE` environment variable is set:\n\n```ruby\nclass API \u003c Grape::API\n  use GrapeRailsLogger::DebugTracer\nend\n```\n\nEnable tracing: `TRACE=1 rails server`. The middleware gracefully degrades if the `debug` gem is not installed.\n\n## Compatibility\n\n- Rails 6.0, 6.1, 7.0, 7.1, 7.2, 8.0+\n- Grape \u003e= 1.6\n- Ruby \u003e= 2.7\n\nIn Rails 7.1+, the gem uses `ActiveSupport::IsolatedExecutionState` for improved thread/Fiber safety. In Rails 6-7.0, it falls back to `Thread.current`.\n\n## Development\n\n```bash\nbundle install\nbundle exec appraisal generate\nbundle exec rspec\nbin/appraisals\nbundle exec standardrb --fix\n```\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/amkisko/grape_rails_logger.rb\n\nContribution policy:\n- New features are not necessarily added to the gem\n- Pull request should have test coverage for affected parts\n- Pull request should have changelog entry\n\nReview policy:\n- It might take up to 2 calendar weeks to review and merge critical fixes\n- It might take up to 6 calendar months to review and merge pull request\n- It might take up to 1 calendar year to review an issue\n\n## Publishing\n\n```sh\nrm grape_rails_logger-*.gem\ngem build grape_rails_logger.gemspec\ngem push grape_rails_logger-*.gem\n```\n\nOr use the release script:\n\n```sh\nusr/bin/release.rb\n```\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famkisko%2Fgrape_rails_logger.rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famkisko%2Fgrape_rails_logger.rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famkisko%2Fgrape_rails_logger.rb/lists"}