Rack middleware logs all paths and queries with Redis
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
spec
.gitignore
MIT-LICENSE
README.textile
Rakefile
config.ru
example.rb

README.textile

Almaz

Almaz is always watching!

Explanation

Almaz is rack middlware which logs request information to a redis server, under a preset user session variable.

Installation

  
    gem install almaz
  

Example

Almaz::Capture

  
    require 'almaz'

    use Almaz::Capture
  
    Almaz.redis_config = {:db => 0, :host => 'localhost', :port => 6379} # this is also the default
    Almaz.session_variable = :user
  

By using Almaz::Capture and setting the session_variable to :user, all request are now logged under ‘almaz::user::(session[:user])’ in redis. Each user gets a separate list in the redis DB. All request that don’t have the session variable :user are logged under ‘almaz::user::’.

Almaz::View

  
    require 'almaz'

    use Almaz::View
    Almaz::View.user('jpoz','password')
  
    use Almaz::Capture
    Almaz.session_variable = :user
  

Almaz::View is a separate middleware allows the information saved by Almaz::Capture into redis to be consumed via json. It has two routes:

  1. ‘/almaz’ a index of all the keys in the Redis DB
  2. ‘/almaz/:val’ the list of request information for the user who has the session variable value :val

Both are protected behind basic HTTP authentication. Which is setup by calling Almaz::View.user(‘username’,‘password’).

Related Projects

Almaz MacRuby Client – http://github.com/jpoz/almaz_client

Coming soon

Almaz::Client

Yet another rack middleware to consume the json given out by Almaz::View.

fail