https://github.com/logdna/logdna_lograge_example
Example architecture using LogDNA, Lograge and Ruby on Rails to build a secret message app.
https://github.com/logdna/logdna_lograge_example
Last synced: about 1 year ago
JSON representation
Example architecture using LogDNA, Lograge and Ruby on Rails to build a secret message app.
- Host: GitHub
- URL: https://github.com/logdna/logdna_lograge_example
- Owner: logdna
- License: mit
- Created: 2021-09-08T03:33:58.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2023-05-05T21:38:06.000Z (about 3 years ago)
- Last Synced: 2025-05-18T21:10:03.489Z (about 1 year ago)
- Language: Ruby
- Size: 998 KB
- Stars: 2
- Watchers: 2
- Forks: 1
- Open Issues: 13
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Ruby on Rails, Lograge and LogDNA
### Welcome, welcome.
First off, thanks for visitng! In this repo you will find instructions on how to tool Rails using the Lograge gem with LogDNA via a simple cryptographic app that deciphers a secret message using a key logged to LogDNA.
## TL;DR;
Been here done that and just wanna see the LogDNA / Lograge specifics?
1. Add LogDNA and Lograge gems to your [Gemfile](src/decipher/Gemfile#L59).
```ruby
gem "logdna"
gem "lograge"
```
2. Enable [Lograge via an initializer](src/decipher/config/initializers/lograge.rb)
```ruby
Rails.application.configure do
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Json.new
end
```
3. Specify LogDNA as your logger in the [environment configs](src/decipher/config/environments/development.rb#L79) and set the [API key](https://app.logdna.com/manage/api-keys).
```ruby
config.logger = Logdna::Ruby.new(
LOGDNA_API_KEY, {
:app => "rails-lograge-decipher"
}
)
```
> **Pro tip:** send data via JSON with a "message" for easy scanning in LogDNA's [Log Viewer](https://docs.logdna.com/docs/how-to-use-the-dashboard). See the log's message definition [here](src/decipher/app/controllers/app_controller.rb#L59).
**Q.E.D.**
## Guide
You can check out the detailed guide [here](./GUIDE.md).
In the end, the gist is to (assuming you got a Rails app already tooled with LogRage handy):
0. Steep tea
1. Connect to LogDNA using your accounts API key.
2. Configure Lograge to utilize LogDNA.
3. Restart Rails.
4. Sit back. Witness logs in LogDNA.
5. Enjoy tea.
## Blog
We wrote a short blog on this that you can read [here](https://www.logdna.com/blog/taming-ruby-on-rails-logging-with-lograge-and-logdna).
## Contributing
[Bug reports](https://github.com/logdna/logdna_lograge_example/issues) and [pull requests](https://github.com/logdna/logdna_lograge_example/pulls) are welcome on GitHub at [logdna/logdna_lograge_example](https://github.com/logdna/logdna_lograge_example). Be sure to first check out our [contributing doc](./CONTRIBUTING.md).
## License
We use a standard [MIT](./LICENSE) license on this repo.