An open API service indexing awesome lists of open source software.

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.

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.