-
-
Save synsa/22acc23a7dc47725abaf0c96dc303153 to your computer and use it in GitHub Desktop.
parsing apache access log with ruby
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rubygems' | |
require 'apache_log_regex' | |
require 'date' | |
format = '%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-agent}i\"' | |
parser = ApacheLogRegex.new(format) | |
File.readlines('/path/to/access-log').collect do |line| | |
p parser.parse line | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment