request-log-analyzer 1.9.6 → 1.9.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.rdoc CHANGED
@@ -24,6 +24,16 @@ request-log-analyzer like this:
24
24
 
25
25
  For more details, other file formats, and available command line options, see the project's wiki at http://github.com/wvanbergen/request-log-analyzer/wiki
26
26
 
27
+ == Benchmarking on different rubies
28
+
29
+ $ time ./bin/request-log-analyzer 40MBRailsFile.log
30
+
31
+ ruby-1.9.2-p0 15.19s user 0.95s system 99% cpu 16.143 total
32
+ ruby-1.8.7 25.21s user 1.02s system 99% cpu 26.238 total
33
+ jruby-1.5.3 32.64s user 4.84s system 99% cpu 37.629 total
34
+ rbx 46.60s user 2.71s system 108% cpu 45.324 total
35
+ macruby 75.00s user 20.10s system 110% cpu 1:26.13 total
36
+
27
37
  == Additional information
28
38
 
29
39
  Request-log-analyzer was designed and built by Willem van Bergen and Bart ten
@@ -13,7 +13,7 @@ module RequestLogAnalyzer
13
13
 
14
14
  # The current version of request-log-analyzer.
15
15
  # Do not change the value by hand; it will be updated automatically by the gem release script.
16
- VERSION = "1.9.6"
16
+ VERSION = "1.9.7"
17
17
 
18
18
 
19
19
  autoload :Controller, 'request_log_analyzer/controller'
@@ -12,7 +12,7 @@ module RequestLogAnalyzer::FileFormat
12
12
  line_definition :started do |line|
13
13
  line.header = true
14
14
  line.teaser = /Started /
15
- line.regexp = /Started ([A-Z]+) "([^"]+)" for (#{ip_address}) at (#{timestamp('%a %b %d %H:%M:%S %z %Y')})/
15
+ line.regexp = /Started ([A-Z]+) "([^"]+)" for (#{ip_address}) at (#{timestamp('%a %b %d %H:%M:%S %z %Y')}|#{timestamp('%Y-%m-%d %H:%M:%S %z')})/
16
16
 
17
17
  line.capture(:method)
18
18
  line.capture(:path)
@@ -85,14 +85,23 @@ module RequestLogAnalyzer::FileFormat
85
85
  MONTHS = %w(Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec)
86
86
 
87
87
  def convert_timestamp(value, definition)
88
- value.gsub!(/\W/,'')
89
- time_as_str = value[-4..-1] # year
90
- # convert the month to a 2-digit representation
91
- month = MONTHS.index(value[3..5])+1
92
- month < 10 ? time_as_str << "0#{month}" : time_as_str << month.to_s
93
-
94
- time_as_str << value[6..13] # day of month + time
95
- time_as_str.to_i
88
+ # the time value can be in 2 formats:
89
+ # - 2010-10-26 02:27:15 +0000 (ruby 1.9.2)
90
+ # - Thu Oct 25 16:15:18 -0800 2010
91
+ if value =~ /^#{CommonRegularExpressions::TIMESTAMP_PARTS['Y']}/
92
+ value.gsub!(/\W/,'')
93
+ value[0..13].to_i
94
+ else
95
+ value.gsub!(/\W/,'')
96
+ time_as_str = value[-4..-1] # year
97
+ # convert the month to a 2-digit representation
98
+ month = MONTHS.index(value[3..5])+1
99
+ month < 10 ? time_as_str << "0#{month}" : time_as_str << month.to_s
100
+
101
+ time_as_str << value[6..13] # day of month + time
102
+ time_as_str.to_i
103
+ end
104
+
96
105
  end
97
106
  end
98
107
 
@@ -2,8 +2,8 @@ Gem::Specification.new do |s|
2
2
  s.name = "request-log-analyzer"
3
3
 
4
4
  # Do not set the version and date field manually, this is done by the release script
5
- s.version = "1.9.6"
6
- s.date = "2010-10-18"
5
+ s.version = "1.9.7"
6
+ s.date = "2010-10-28"
7
7
 
8
8
  s.rubyforge_project = 'r-l-a'
9
9
 
@@ -20,6 +20,12 @@ describe RequestLogAnalyzer::FileFormat::Rails do
20
20
  @file_format.should parse_line(line).as(:started).and_capture(:method => 'GET',
21
21
  :path => '/queries', :ip => '127.0.0.1', :timestamp => 20101025161518)
22
22
  end
23
+
24
+ it "should parse :started lines in Ruby 1.9.2 format correctly" do
25
+ line = 'Started GET "/queries" for 127.0.0.1 at 2010-10-26 02:27:15 +0000'
26
+ @file_format.should parse_line(line).as(:started).and_capture(:method => 'GET',
27
+ :path => '/queries', :ip => '127.0.0.1', :timestamp => 20101026022715)
28
+ end
23
29
 
24
30
  it "should parse :processing lines correctly" do
25
31
  line = ' Processing by QueriesController#index as HTML'
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 1
7
7
  - 9
8
- - 6
9
- version: 1.9.6
8
+ - 7
9
+ version: 1.9.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Willem van Bergen
@@ -15,14 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-10-18 00:00:00 +02:00
18
+ date: 2010-10-28 00:00:00 -07:00
19
19
  default_executable: request-log-analyzer
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
22
22
  name: rake
23
23
  prerelease: false
24
24
  requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
25
  requirements:
27
26
  - - ">="
28
27
  - !ruby/object:Gem::Version
@@ -35,7 +34,6 @@ dependencies:
35
34
  name: rspec
36
35
  prerelease: false
37
36
  requirement: &id002 !ruby/object:Gem::Requirement
38
- none: false
39
37
  requirements:
40
38
  - - ~>
41
39
  - !ruby/object:Gem::Version
@@ -49,7 +47,6 @@ dependencies:
49
47
  name: activerecord
50
48
  prerelease: false
51
49
  requirement: &id003 !ruby/object:Gem::Requirement
52
- none: false
53
50
  requirements:
54
51
  - - ">="
55
52
  - !ruby/object:Gem::Version
@@ -62,7 +59,6 @@ dependencies:
62
59
  name: sqlite3-ruby
63
60
  prerelease: false
64
61
  requirement: &id004 !ruby/object:Gem::Requirement
65
- none: false
66
62
  requirements:
67
63
  - - ">="
68
64
  - !ruby/object:Gem::Version
@@ -235,7 +231,6 @@ rdoc_options:
235
231
  require_paths:
236
232
  - lib
237
233
  required_ruby_version: !ruby/object:Gem::Requirement
238
- none: false
239
234
  requirements:
240
235
  - - ">="
241
236
  - !ruby/object:Gem::Version
@@ -243,7 +238,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
243
238
  - 0
244
239
  version: "0"
245
240
  required_rubygems_version: !ruby/object:Gem::Requirement
246
- none: false
247
241
  requirements:
248
242
  - - ">="
249
243
  - !ruby/object:Gem::Version
@@ -253,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
253
247
  requirements:
254
248
  - To use the database inserter, ActiveRecord and an appropriate database adapter are required.
255
249
  rubyforge_project: r-l-a
256
- rubygems_version: 1.3.7
250
+ rubygems_version: 1.3.6
257
251
  signing_key:
258
252
  specification_version: 3
259
253
  summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers