rack/httperflog

Generates a replay log of the actions performed by the web application.

When a url is requested, it is logged to the replay log (if the response status is not an error).

Then, if the response content type is html, paths for the images, scripts, stylesheets and iframes are extracted and logged as well.

Usage

On your rack configuration, add the middleware providing the following parameters:

...
use ReplayLogger, :ping_urls, "/log/path", "/flag/path"
...
ping_urls

pass :ping_urls for making the middleware perform an http get to validate each path parsed from the html body returns a status 200. WARNING: only use if your http server can handle more than one concurrent connection (e.g.: you are using passenger or have a cluster of load balanced mongrels). Any other value avoids performing the check requests.

log_path

path to the log file that will contain the session log.

flag_path

the logging will be performed only when the file pointed by flag_path exists.

On Rails

Rails::Initializer.run do |config|

config.gem 'rack-httperflog', :lib => "rack/httperflog"

config.middleware.use "Rack::Httperflog", :ping_urls, Rails.root.join("log", "wsess.log"), Rails.root.join("log", "wsess.record")

end

Notes

The log will not contain any newlines (which signal separate sessions on httperf’s wsesslog format). If you want to generated separated logs, simple echo a new line in the session log with a command like:

echo '' >> log/path

Note on Patches/Pull Requests

  • Fork the project.

  • Make your feature addition or bug fix.

  • Add tests for it. This is important so I don’t break it in a future version unintentionally.

  • Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but

    bump version in a commit by itself I can ignore when I pull)
    
  • Send me a pull request. Bonus points for topic branches.

Copyright © 2009 Emmanuel Oga. See LICENSE for details.