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.
Been here done that and just wanna see the LogDNA / Lograge specifics?
- Add LogDNA and Lograge gems to your Gemfile.
gem "logdna"
gem "lograge"
- Enable Lograge via an initializer
Rails.application.configure do
config.lograge.enabled = true
config.lograge.formatter = Lograge::Formatters::Json.new
end
- Specify LogDNA as your logger in the environment configs and set the API key.
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. See the log's message definition here.
Q.E.D.
You can check out the detailed guide here.
In the end, the gist is to (assuming you got a Rails app already tooled with LogRage handy):
- Steep tea
- Connect to LogDNA using your accounts API key.
- Configure Lograge to utilize LogDNA.
- Restart Rails.
- Sit back. Witness logs in LogDNA.
- Enjoy tea.
We wrote a short blog on this that you can read here.
Bug reports and pull requests are welcome on GitHub at logdna/logdna_lograge_example. Be sure to first check out our contributing doc.
We use a standard MIT license on this repo.