Prev | Current Page 278 | Next

David Berube

"Practical Reporting with Ruby and Rails"

pdf.rpdf.
CHAPTER 10 n CALCULATING COSTS BY ANALYZING APACHE WEB LOGS 200
Downloading a Parser Library
The log_parser.rb library is part of the Mint plug-in for Rails. Mint (http://haveamint.com)
is commercial software used to analyze web sites, and the Mint plug-in helps you to connect
your Rails application to Mint. However, you can use the log_parser.rb library from
the Mint plug-in for other purposes, as you will here. You can find out more about the
Mint plug-in at http://nubyonrails.com/articles/2006/02/16/activerecord-model-for-mint,
For this example, you??™ll use the log_parser.rb library to provide an easy means to
parse the Apache logs in a variety of common formats. Also, the logs controller will use it
to load the data into the database.
Download the log_parser.rb library from the following URL:
http://topfunky.net/svn/plugins/mint/lib/log_parser.rb
Save it as lib/log_parser.rb.
Creating the Routing File
Next, you??™ll need a config/routes.rb file. Add a line that lets you set the default home
page for the user, as shown in Listing 10-8.


Pages:
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290