request-log-analyzer 1.7.0 → 1.10.0
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/.gitignore +4 -1
- data/DESIGN.rdoc +0 -1
- data/Gemfile +2 -0
- data/README.rdoc +16 -5
- data/bin/request-log-analyzer +4 -2
- data/lib/cli/database_console_init.rb +1 -1
- data/lib/cli/tools.rb +2 -1
- data/lib/mixins/gets_memory_protection.rb +1 -1
- data/lib/request_log_analyzer/aggregator/summarizer.rb +2 -2
- data/lib/request_log_analyzer/aggregator.rb +3 -3
- data/lib/request_log_analyzer/controller.rb +42 -36
- data/lib/request_log_analyzer/database.rb +5 -3
- data/lib/request_log_analyzer/file_format/apache.rb +19 -28
- data/lib/request_log_analyzer/file_format/delayed_job2.rb +38 -0
- data/lib/request_log_analyzer/file_format/delayed_job21.rb +39 -0
- data/lib/request_log_analyzer/file_format/haproxy.rb +138 -0
- data/lib/request_log_analyzer/file_format/oink.rb +96 -0
- data/lib/request_log_analyzer/file_format/postgresql.rb +7 -6
- data/lib/request_log_analyzer/file_format/rails.rb +4 -4
- data/lib/request_log_analyzer/file_format/rails3.rb +34 -11
- data/lib/request_log_analyzer/file_format/w3c.rb +56 -0
- data/lib/request_log_analyzer/file_format.rb +33 -10
- data/lib/request_log_analyzer/filter.rb +3 -5
- data/lib/request_log_analyzer/output/fancy_html.rb +0 -5
- data/lib/request_log_analyzer/output.rb +6 -7
- data/lib/request_log_analyzer/request.rb +17 -3
- data/lib/request_log_analyzer/source/log_parser.rb +3 -1
- data/lib/request_log_analyzer/source.rb +2 -6
- data/lib/request_log_analyzer/tracker/duration.rb +7 -0
- data/lib/request_log_analyzer/tracker/numeric_value.rb +123 -12
- data/lib/request_log_analyzer/tracker/traffic.rb +7 -0
- data/lib/request_log_analyzer/tracker.rb +6 -5
- data/lib/request_log_analyzer.rb +36 -17
- data/request-log-analyzer.gemspec +9 -6
- data/spec/fixtures/oink_22.log +19 -0
- data/spec/fixtures/oink_22_failure.log +17 -0
- data/spec/fixtures/postgresql.log +29 -2980
- data/spec/integration/command_line_usage_spec.rb +4 -4
- data/spec/integration/mailer_spec.rb +20 -4
- data/spec/integration/munin_plugins_rails_spec.rb +1 -1
- data/spec/integration/scout_spec.rb +1 -1
- data/spec/lib/helpers.rb +2 -2
- data/spec/lib/macros.rb +1 -1
- data/spec/lib/matchers.rb +1 -1
- data/spec/lib/mocks.rb +1 -1
- data/spec/spec_helper.rb +10 -10
- data/spec/unit/aggregator/database_inserter_spec.rb +1 -1
- data/spec/unit/aggregator/summarizer_spec.rb +1 -1
- data/spec/unit/controller/controller_spec.rb +1 -1
- data/spec/unit/controller/log_processor_spec.rb +1 -1
- data/spec/unit/database/base_class_spec.rb +1 -1
- data/spec/unit/database/connection_spec.rb +1 -1
- data/spec/unit/database/database_spec.rb +1 -1
- data/spec/unit/file_format/amazon_s3_format_spec.rb +1 -1
- data/spec/unit/file_format/apache_format_spec.rb +18 -1
- data/spec/unit/file_format/common_regular_expressions_spec.rb +1 -1
- data/spec/unit/file_format/delayed_job21_format_spec.rb +60 -0
- data/spec/unit/file_format/delayed_job2_format_spec.rb +60 -0
- data/spec/unit/file_format/delayed_job_format_spec.rb +2 -2
- data/spec/unit/file_format/file_format_api_spec.rb +2 -2
- data/spec/unit/file_format/format_autodetection_spec.rb +7 -7
- data/spec/unit/file_format/haproxy_format_spec.rb +84 -0
- data/spec/unit/file_format/line_definition_spec.rb +1 -1
- data/spec/unit/file_format/merb_format_spec.rb +1 -1
- data/spec/unit/file_format/mysql_format_spec.rb +1 -1
- data/spec/unit/file_format/oink_format_spec.rb +105 -0
- data/spec/unit/file_format/postgresql_format_spec.rb +24 -46
- data/spec/unit/file_format/rack_format_spec.rb +1 -1
- data/spec/unit/file_format/rails3_format_spec.rb +41 -14
- data/spec/unit/file_format/rails_format_spec.rb +11 -1
- data/spec/unit/file_format/w3c_format_spec.rb +46 -0
- data/spec/unit/filter/anonymize_filter_spec.rb +1 -1
- data/spec/unit/filter/field_filter_spec.rb +1 -1
- data/spec/unit/filter/filter_spec.rb +1 -1
- data/spec/unit/filter/timespan_filter_spec.rb +1 -1
- data/spec/unit/mailer_spec.rb +1 -1
- data/spec/unit/request_spec.rb +1 -1
- data/spec/unit/source/log_parser_spec.rb +1 -1
- data/spec/unit/tracker/duration_tracker_spec.rb +4 -2
- data/spec/unit/tracker/frequency_tracker_spec.rb +1 -1
- data/spec/unit/tracker/hourly_spread_spec.rb +1 -1
- data/spec/unit/tracker/numeric_value_tracker_spec.rb +38 -17
- data/spec/unit/tracker/timespan_tracker_spec.rb +1 -1
- data/spec/unit/tracker/tracker_api_spec.rb +1 -1
- data/spec/unit/tracker/traffic_tracker_spec.rb +1 -1
- data/tasks/github-gem.rake +97 -60
- data/tasks/request_log_analyzer.rake +102 -0
- metadata +198 -153
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module RequestLogAnalyzer::Tracker
|
|
2
|
-
|
|
2
|
+
|
|
3
3
|
class NumericValue < Base
|
|
4
4
|
|
|
5
5
|
attr_reader :categories
|
|
@@ -8,7 +8,7 @@ module RequestLogAnalyzer::Tracker
|
|
|
8
8
|
# options are set that are used to extract and categorize the values during
|
|
9
9
|
# parsing. Two lambda procedures are created for these tasks
|
|
10
10
|
def prepare
|
|
11
|
-
|
|
11
|
+
|
|
12
12
|
raise "No value field set up for numeric tracker #{self.inspect}" unless options[:value]
|
|
13
13
|
raise "No categorizer set up for numeric tracker #{self.inspect}" unless options[:category]
|
|
14
14
|
|
|
@@ -16,15 +16,22 @@ module RequestLogAnalyzer::Tracker
|
|
|
16
16
|
@categorizer = create_lambda(options[:category])
|
|
17
17
|
@valueizer = create_lambda(options[:value])
|
|
18
18
|
end
|
|
19
|
+
|
|
20
|
+
@number_of_buckets = options[:number_of_buckets] || 1000
|
|
21
|
+
@min_bucket_value = options[:min_bucket_value] ? options[:min_bucket_value].to_f : 0.000001
|
|
22
|
+
@max_bucket_value = options[:max_bucket_value] ? options[:max_bucket_value].to_f : 1_000_000_000
|
|
23
|
+
|
|
24
|
+
# precalculate the bucket size
|
|
25
|
+
@bucket_size = (Math.log(@max_bucket_value) - Math.log(@min_bucket_value)) / @number_of_buckets.to_f
|
|
19
26
|
|
|
20
27
|
@categories = {}
|
|
21
28
|
end
|
|
22
29
|
|
|
23
30
|
# Get the value information from the request and store it in the respective categories.
|
|
24
31
|
#
|
|
25
|
-
# If a request can contain multiple usable values for this tracker, the :multiple option
|
|
32
|
+
# If a request can contain multiple usable values for this tracker, the :multiple option
|
|
26
33
|
# should be set to true. In this case, all the values and respective categories will be
|
|
27
|
-
# read from the request using the #every method from the fields given in the :value and
|
|
34
|
+
# read from the request using the #every method from the fields given in the :value and
|
|
28
35
|
# :category option.
|
|
29
36
|
#
|
|
30
37
|
# If the request contains only one suitable value and the :multiple is not set, it will
|
|
@@ -38,11 +45,11 @@ module RequestLogAnalyzer::Tracker
|
|
|
38
45
|
found_categories = request.every(options[:category])
|
|
39
46
|
found_values = request.every(options[:value])
|
|
40
47
|
raise "Capture mismatch for multiple values in a request" unless found_categories.length == found_values.length
|
|
41
|
-
|
|
42
|
-
found_categories.each_with_index do |cat, index|
|
|
48
|
+
|
|
49
|
+
found_categories.each_with_index do |cat, index|
|
|
43
50
|
update_statistics(cat, found_values[index]) if cat && found_values[index].kind_of?(Numeric)
|
|
44
51
|
end
|
|
45
|
-
|
|
52
|
+
|
|
46
53
|
else
|
|
47
54
|
category = @categorizer.call(request)
|
|
48
55
|
value = @valueizer.call(request)
|
|
@@ -90,7 +97,7 @@ module RequestLogAnalyzer::Tracker
|
|
|
90
97
|
sortings.each do |sorting|
|
|
91
98
|
report_table(output, sorting, :title => "#{title} - by #{sorting}")
|
|
92
99
|
end
|
|
93
|
-
|
|
100
|
+
|
|
94
101
|
if options[:total]
|
|
95
102
|
output.puts
|
|
96
103
|
output.puts "#{output.colorize(title, :white, :bold)} - total: " + output.colorize(display_value(sum_overall), :brown, :bold)
|
|
@@ -114,15 +121,115 @@ module RequestLogAnalyzer::Tracker
|
|
|
114
121
|
# Returns all the categories and the tracked duration as a hash than can be exported to YAML
|
|
115
122
|
def to_yaml_object
|
|
116
123
|
return nil if @categories.empty?
|
|
124
|
+
@categories.each do |cat, info|
|
|
125
|
+
info[:stddev] = stddev(cat)
|
|
126
|
+
info[:median] = median(cat) if info[:buckets]
|
|
127
|
+
info[:interval_95_percent] = percentile_interval(cat, 95) if info[:buckets]
|
|
128
|
+
end
|
|
117
129
|
@categories
|
|
118
130
|
end
|
|
131
|
+
|
|
132
|
+
# Returns the bucket index for a value
|
|
133
|
+
def bucket_index(value)
|
|
134
|
+
return 0 if value < @min_bucket_value
|
|
135
|
+
return @number_of_buckets - 1 if value >= @max_bucket_value
|
|
136
|
+
|
|
137
|
+
((Math.log(value) - Math.log(@min_bucket_value)) / @bucket_size).floor
|
|
138
|
+
end
|
|
139
|
+
|
|
140
|
+
# Returns the lower value of a bucket given its index
|
|
141
|
+
def bucket_lower_bound(index)
|
|
142
|
+
Math.exp((index * @bucket_size) + Math.log(@min_bucket_value))
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
# Returns the upper value of a bucket given its index
|
|
146
|
+
def bucket_upper_bound(index)
|
|
147
|
+
bucket_lower_bound(index + 1)
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
# Returns the average of the lower and upper bound of the bucket.
|
|
151
|
+
def bucket_average_value(index)
|
|
152
|
+
(bucket_lower_bound(index) + bucket_upper_bound(index)) / 2
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
# Returns a single value representing a bucket.
|
|
156
|
+
def bucket_value(index, type = nil)
|
|
157
|
+
case type
|
|
158
|
+
when :begin, :start, :lower, :lower_bound; bucket_lower_bound(index)
|
|
159
|
+
when :end, :finish, :upper, :upper_bound; bucket_upper_bound(index)
|
|
160
|
+
else bucket_average_value(index)
|
|
161
|
+
end
|
|
162
|
+
end
|
|
163
|
+
|
|
164
|
+
# Returns the range of values for a bucket.
|
|
165
|
+
def bucket_interval(index)
|
|
166
|
+
Range.new(bucket_lower_bound(index), bucket_upper_bound(index), true)
|
|
167
|
+
end
|
|
168
|
+
|
|
169
|
+
# Records a hit on a bucket that includes the given value.
|
|
170
|
+
def bucketize(category, value)
|
|
171
|
+
@categories[category][:buckets][bucket_index(value)] += 1
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
# Returns the upper bound value that would include x% of the hits.
|
|
175
|
+
def percentile_index(category, x, inclusive = false)
|
|
176
|
+
total_encountered = 0
|
|
177
|
+
@categories[category][:buckets].each_with_index do |count, index|
|
|
178
|
+
total_encountered += count
|
|
179
|
+
percentage = ((total_encountered.to_f / hits(category).to_f) * 100).floor
|
|
180
|
+
return index if (inclusive && percentage >= x) || (!inclusive && percentage > x)
|
|
181
|
+
end
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
def percentile_indices(category, start, finish)
|
|
185
|
+
result = [nil, nil]
|
|
186
|
+
total_encountered = 0
|
|
187
|
+
@categories[category][:buckets].each_with_index do |count, index|
|
|
188
|
+
total_encountered += count
|
|
189
|
+
percentage = ((total_encountered.to_f / hits(category).to_f) * 100).floor
|
|
190
|
+
if !result[0] && percentage > start
|
|
191
|
+
result[0] = index
|
|
192
|
+
elsif !result[1] && percentage >= finish
|
|
193
|
+
result[1] = index
|
|
194
|
+
return result
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
|
|
199
|
+
def percentile(category, x, type = nil)
|
|
200
|
+
bucket_value(percentile_index(category, x, type == :upper), type)
|
|
201
|
+
end
|
|
202
|
+
|
|
119
203
|
|
|
204
|
+
def median(category)
|
|
205
|
+
percentile(category, 50, :average)
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# Returns a percentile interval, i.e. the lower bound and the upper bound of the values
|
|
209
|
+
# that represent the x%-interval for the bucketized dataset.
|
|
210
|
+
#
|
|
211
|
+
# A 90% interval means that 5% of the values would have been lower than the lower bound and
|
|
212
|
+
# 5% would have been higher than the upper bound, leaving 90% of the values within the bounds.
|
|
213
|
+
# You can also provide a Range to specify the lower bound and upper bound percentages (e.g. 5..95).
|
|
214
|
+
def percentile_interval(category, x)
|
|
215
|
+
case x
|
|
216
|
+
when Range
|
|
217
|
+
lower, upper = percentile_indices(category, x.begin, x.end)
|
|
218
|
+
Range.new(bucket_lower_bound(lower), bucket_upper_bound(upper))
|
|
219
|
+
when Numeric
|
|
220
|
+
percentile_interval(category, Range.new((100 - x) / 2, (100 - (100 - x) / 2)))
|
|
221
|
+
else
|
|
222
|
+
raise 'What does it mean?'
|
|
223
|
+
end
|
|
224
|
+
end
|
|
120
225
|
|
|
121
|
-
# Update
|
|
226
|
+
# Update the running calculation of statistics with the newly found numeric value.
|
|
122
227
|
# <tt>category</tt>:: The category for which to update the running statistics calculations
|
|
123
228
|
# <tt>number</tt>:: The numeric value to update the calculations with.
|
|
124
229
|
def update_statistics(category, number)
|
|
125
|
-
@categories[category] ||= {:hits => 0, :sum => 0, :mean => 0.0, :sum_of_squares => 0.0, :min => number, :max => number
|
|
230
|
+
@categories[category] ||= { :hits => 0, :sum => 0, :mean => 0.0, :sum_of_squares => 0.0, :min => number, :max => number,
|
|
231
|
+
:buckets => Array.new(@number_of_buckets, 0) }
|
|
232
|
+
|
|
126
233
|
delta = number - @categories[category][:mean]
|
|
127
234
|
|
|
128
235
|
@categories[category][:hits] += 1
|
|
@@ -131,6 +238,8 @@ module RequestLogAnalyzer::Tracker
|
|
|
131
238
|
@categories[category][:sum] += number
|
|
132
239
|
@categories[category][:min] = number if number < @categories[category][:min]
|
|
133
240
|
@categories[category][:max] = number if number > @categories[category][:max]
|
|
241
|
+
|
|
242
|
+
bucketize(category, number)
|
|
134
243
|
end
|
|
135
244
|
|
|
136
245
|
# Get the number of hits of a specific category.
|
|
@@ -210,14 +319,16 @@ module RequestLogAnalyzer::Tracker
|
|
|
210
319
|
{:title => 'Mean', :align => :right, :highlight => (options[:highlight] == :mean), :min_width => 6},
|
|
211
320
|
{:title => 'StdDev', :align => :right, :highlight => (options[:highlight] == :stddev), :min_width => 6},
|
|
212
321
|
{:title => 'Min', :align => :right, :highlight => (options[:highlight] == :min), :min_width => 6},
|
|
213
|
-
{:title => 'Max', :align => :right, :highlight => (options[:highlight] == :max), :min_width => 6}
|
|
322
|
+
{:title => 'Max', :align => :right, :highlight => (options[:highlight] == :max), :min_width => 6},
|
|
323
|
+
{:title => '95 %tile', :align => :right, :highlight => (options[:highlight] == :percentile_interval), :min_width => 11}
|
|
214
324
|
]
|
|
215
325
|
end
|
|
216
326
|
|
|
217
327
|
# Returns a row of statistics information for a report table, given a category
|
|
218
328
|
def statistics_row(cat)
|
|
219
329
|
[cat, hits(cat), display_value(sum(cat)), display_value(mean(cat)), display_value(stddev(cat)),
|
|
220
|
-
display_value(min(cat)), display_value(max(cat))
|
|
330
|
+
display_value(min(cat)), display_value(max(cat)),
|
|
331
|
+
display_value(percentile_interval(cat, 95).begin) + '-' + display_value(percentile_interval(cat, 95).end) ]
|
|
221
332
|
end
|
|
222
333
|
end
|
|
223
334
|
end
|
|
@@ -16,6 +16,13 @@ module RequestLogAnalyzer::Tracker
|
|
|
16
16
|
options[:value] = options[:traffic] if options[:traffic]
|
|
17
17
|
options[:total] = true
|
|
18
18
|
super
|
|
19
|
+
|
|
20
|
+
@number_of_buckets = options[:number_of_buckets] || 1000
|
|
21
|
+
@min_bucket_value = options[:min_bucket_value] ? options[:min_bucket_value].to_f : 1
|
|
22
|
+
@max_bucket_value = options[:max_bucket_value] ? options[:max_bucket_value].to_f : 1000_000_000_000
|
|
23
|
+
|
|
24
|
+
# precalculate the bucket size
|
|
25
|
+
@bucket_size = (Math.log(@max_bucket_value) - Math.log(@min_bucket_value)) / @number_of_buckets.to_f
|
|
19
26
|
end
|
|
20
27
|
|
|
21
28
|
# Formats the traffic number using x B/kB/MB/GB etc notation
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
module RequestLogAnalyzer::Tracker
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
autoload :Duration, 'request_log_analyzer/tracker/duration'
|
|
4
|
+
autoload :Frequency, 'request_log_analyzer/tracker/frequency'
|
|
5
|
+
autoload :HourlySpread, 'request_log_analyzer/tracker/hourly_spread'
|
|
6
|
+
autoload :NumericValue, 'request_log_analyzer/tracker/numeric_value'
|
|
7
|
+
autoload :Timespan, 'request_log_analyzer/tracker/timespan'
|
|
8
|
+
autoload :Traffic, 'request_log_analyzer/tracker/traffic'
|
|
8
9
|
|
|
9
10
|
# Base Tracker class. All other trackers inherit from this class
|
|
10
11
|
#
|
data/lib/request_log_analyzer.rb
CHANGED
|
@@ -4,40 +4,59 @@ require 'date'
|
|
|
4
4
|
Encoding.default_external = 'binary' if defined? Encoding and Encoding.respond_to? 'default_external='
|
|
5
5
|
|
|
6
6
|
# RequestLogAnalyzer is the base namespace in which all functionality of RequestLogAnalyzer is implemented.
|
|
7
|
+
# This module itselfs contains some functions to help with class and source file loading. The actual
|
|
8
|
+
# application startup code resides in the {RequestLogAnalyzer::Controller} class.
|
|
7
9
|
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
+
# The {RequestLogAnalyzer::VERSION} constant can be used to determine what version of request-log-analyzer
|
|
11
|
+
# is running.
|
|
10
12
|
module RequestLogAnalyzer
|
|
11
13
|
|
|
12
14
|
# The current version of request-log-analyzer.
|
|
13
15
|
# Do not change the value by hand; it will be updated automatically by the gem release script.
|
|
14
|
-
VERSION = "1.
|
|
16
|
+
VERSION = "1.10.0"
|
|
15
17
|
|
|
16
|
-
# Loads constants in the RequestLogAnalyzer namespace using self.load_default_class_file(base, const)
|
|
17
|
-
# <tt>const</tt>:: The constant that is not yet loaded in the RequestLogAnalyzer namespace. This should be passed as a string or symbol.
|
|
18
|
-
def self.const_missing(const)
|
|
19
|
-
load_default_class_file(RequestLogAnalyzer, const)
|
|
20
|
-
end
|
|
21
18
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
autoload :Controller, 'request_log_analyzer/controller'
|
|
20
|
+
autoload :Aggregator, 'request_log_analyzer/aggregator'
|
|
21
|
+
autoload :Database, 'request_log_analyzer/database'
|
|
22
|
+
autoload :FileFormat, 'request_log_analyzer/file_format'
|
|
23
|
+
autoload :Filter, 'request_log_analyzer/filter'
|
|
24
|
+
autoload :LineDefinition, 'request_log_analyzer/line_definition'
|
|
25
|
+
autoload :LogProcessor, 'request_log_analyzer/log_processor'
|
|
26
|
+
autoload :Mailer, 'request_log_analyzer/mailer'
|
|
27
|
+
autoload :Output, 'request_log_analyzer/output'
|
|
28
|
+
autoload :Request, 'request_log_analyzer/request'
|
|
29
|
+
autoload :Source, 'request_log_analyzer/source'
|
|
30
|
+
autoload :Tracker, 'request_log_analyzer/tracker'
|
|
31
|
+
|
|
32
|
+
# Loads constants that reside in the RequestLogAnalyzer tree using the constant name and its base
|
|
33
|
+
# constant to determine the filename.
|
|
34
|
+
# @param [Module] base The base constant to load the constant from. This should be <tt>Foo</tt> when
|
|
35
|
+
# the constant <tt>Foo::Bar</tt> is being loaded.
|
|
36
|
+
# @param [Symbol] const The constant to load from the base constant as a string or symbol. This
|
|
37
|
+
# should be <tt>"Bar"<tt> or <tt>:Bar</tt> when the constant <tt>Foo::Bar</tt> is being loaded.
|
|
38
|
+
# @return [Module] The loaded module, nil if it was not found on the expected location.
|
|
26
39
|
def self.load_default_class_file(base, const)
|
|
27
40
|
require "#{to_underscore("#{base.name}::#{const}")}"
|
|
28
41
|
base.const_get(const) if base.const_defined?(const)
|
|
29
42
|
end
|
|
30
43
|
|
|
31
|
-
# Convert a string/symbol in camelcase (RequestLogAnalyzer::Controller) to underscores
|
|
32
|
-
# This function can be used to load the file (using
|
|
33
|
-
# <tt>
|
|
44
|
+
# Convert a string/symbol in camelcase ({RequestLogAnalyzer::Controller}) to underscores
|
|
45
|
+
# (<tt>request_log_analyzer/controller</tt>). This function can be used to load the file (using
|
|
46
|
+
# <tt>require</tt>) in which the given constant is defined.
|
|
47
|
+
#
|
|
48
|
+
# @param [#to_s] str The string-like to convert in the following format: <tt>ModuleName::ClassName</tt>.
|
|
49
|
+
# @return [String] The input string converted to underscore form.
|
|
34
50
|
def self.to_underscore(str)
|
|
35
51
|
str.to_s.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').gsub(/([a-z\d])([A-Z])/,'\1_\2').tr("-", "_").downcase
|
|
36
52
|
end
|
|
37
53
|
|
|
38
54
|
# Convert a string/symbol in underscores (<tt>request_log_analyzer/controller</tt>) to camelcase
|
|
39
|
-
# (
|
|
40
|
-
#
|
|
55
|
+
# ({RequestLogAnalyzer::Controller}). This can be used to find the class that is defined in a given
|
|
56
|
+
# filename.
|
|
57
|
+
#
|
|
58
|
+
# @param [#to_s] str The string-like to convert in the following format: <tt>module_name/class_name</tt>.
|
|
59
|
+
# @return [String] The input string converted to camelcase form.
|
|
41
60
|
def self.to_camelcase(str)
|
|
42
61
|
str.to_s.gsub(/\/(.?)/) { "::" + $1.upcase }.gsub(/(^|_)(.)/) { $2.upcase }
|
|
43
62
|
end
|
|
@@ -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.
|
|
6
|
-
s.date = "
|
|
5
|
+
s.version = "1.10.0"
|
|
6
|
+
s.date = "2011-02-26"
|
|
7
7
|
|
|
8
8
|
s.rubyforge_project = 'r-l-a'
|
|
9
9
|
|
|
@@ -27,8 +27,11 @@ Gem::Specification.new do |s|
|
|
|
27
27
|
|
|
28
28
|
s.requirements << "To use the database inserter, ActiveRecord and an appropriate database adapter are required."
|
|
29
29
|
|
|
30
|
-
s.add_development_dependency('
|
|
31
|
-
s.add_development_dependency('
|
|
30
|
+
s.add_development_dependency('rake')
|
|
31
|
+
s.add_development_dependency('rspec', '~> 2.0')
|
|
32
|
+
|
|
33
|
+
s.add_development_dependency('activerecord')
|
|
34
|
+
s.add_development_dependency('sqlite3-ruby')
|
|
32
35
|
|
|
33
36
|
s.authors = ['Willem van Bergen', 'Bart ten Brinke']
|
|
34
37
|
s.email = ['willem@railsdoctors.com', 'bart@railsdoctors.com']
|
|
@@ -36,6 +39,6 @@ Gem::Specification.new do |s|
|
|
|
36
39
|
|
|
37
40
|
# The files and test_files directives are set automatically by the release script.
|
|
38
41
|
# Do not change them by hand, but make sure to add the files to the git repository.
|
|
39
|
-
s.files = %w(
|
|
40
|
-
s.test_files = %w(spec/
|
|
42
|
+
s.files = %w(.gitignore DESIGN.rdoc Gemfile LICENSE README.rdoc Rakefile bin/request-log-analyzer lib/cli/command_line_arguments.rb lib/cli/database_console.rb lib/cli/database_console_init.rb lib/cli/progressbar.rb lib/cli/tools.rb lib/mixins/gets_memory_protection.rb lib/request_log_analyzer.rb lib/request_log_analyzer/aggregator.rb lib/request_log_analyzer/aggregator/database_inserter.rb lib/request_log_analyzer/aggregator/echo.rb lib/request_log_analyzer/aggregator/summarizer.rb lib/request_log_analyzer/controller.rb lib/request_log_analyzer/database.rb lib/request_log_analyzer/database/base.rb lib/request_log_analyzer/database/connection.rb lib/request_log_analyzer/database/request.rb lib/request_log_analyzer/database/source.rb lib/request_log_analyzer/database/warning.rb lib/request_log_analyzer/file_format.rb lib/request_log_analyzer/file_format/amazon_s3.rb lib/request_log_analyzer/file_format/apache.rb lib/request_log_analyzer/file_format/delayed_job.rb lib/request_log_analyzer/file_format/delayed_job2.rb lib/request_log_analyzer/file_format/delayed_job21.rb lib/request_log_analyzer/file_format/haproxy.rb lib/request_log_analyzer/file_format/merb.rb lib/request_log_analyzer/file_format/mysql.rb lib/request_log_analyzer/file_format/oink.rb lib/request_log_analyzer/file_format/postgresql.rb lib/request_log_analyzer/file_format/rack.rb lib/request_log_analyzer/file_format/rails.rb lib/request_log_analyzer/file_format/rails3.rb lib/request_log_analyzer/file_format/rails_development.rb lib/request_log_analyzer/file_format/w3c.rb lib/request_log_analyzer/filter.rb lib/request_log_analyzer/filter/anonymize.rb lib/request_log_analyzer/filter/field.rb lib/request_log_analyzer/filter/timespan.rb lib/request_log_analyzer/line_definition.rb lib/request_log_analyzer/log_processor.rb lib/request_log_analyzer/mailer.rb lib/request_log_analyzer/output.rb lib/request_log_analyzer/output/fancy_html.rb lib/request_log_analyzer/output/fixed_width.rb lib/request_log_analyzer/output/html.rb lib/request_log_analyzer/request.rb lib/request_log_analyzer/source.rb lib/request_log_analyzer/source/database_loader.rb lib/request_log_analyzer/source/log_parser.rb lib/request_log_analyzer/tracker.rb lib/request_log_analyzer/tracker/duration.rb lib/request_log_analyzer/tracker/frequency.rb lib/request_log_analyzer/tracker/hourly_spread.rb lib/request_log_analyzer/tracker/numeric_value.rb lib/request_log_analyzer/tracker/timespan.rb lib/request_log_analyzer/tracker/traffic.rb request-log-analyzer.gemspec spec/database.yml spec/fixtures/apache_combined.log spec/fixtures/apache_common.log spec/fixtures/decompression.log spec/fixtures/decompression.log.bz2 spec/fixtures/decompression.log.gz spec/fixtures/decompression.log.zip spec/fixtures/decompression.tar.gz spec/fixtures/decompression.tgz spec/fixtures/header_and_footer.log spec/fixtures/merb.log spec/fixtures/merb_prefixed.log spec/fixtures/multiple_files_1.log spec/fixtures/multiple_files_2.log spec/fixtures/mysql_slow_query.log spec/fixtures/oink_22.log spec/fixtures/oink_22_failure.log spec/fixtures/postgresql.log spec/fixtures/rails.db spec/fixtures/rails_1x.log spec/fixtures/rails_22.log spec/fixtures/rails_22_cached.log spec/fixtures/rails_unordered.log spec/fixtures/sinatra.log spec/fixtures/syslog_1x.log spec/fixtures/test_file_format.log spec/fixtures/test_language_combined.log spec/fixtures/test_order.log spec/integration/command_line_usage_spec.rb spec/integration/mailer_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/integration/scout_spec.rb spec/lib/helpers.rb spec/lib/macros.rb spec/lib/matchers.rb spec/lib/mocks.rb spec/lib/testing_format.rb spec/spec_helper.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/controller/controller_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/database/base_class_spec.rb spec/unit/database/connection_spec.rb spec/unit/database/database_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/file_format/apache_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/delayed_job21_format_spec.rb spec/unit/file_format/delayed_job2_format_spec.rb spec/unit/file_format/delayed_job_format_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/haproxy_format_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/file_format/oink_format_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/unit/file_format/rails_format_spec.rb spec/unit/file_format/w3c_format_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/filter/filter_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/mailer_spec.rb spec/unit/request_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/tracker/traffic_tracker_spec.rb tasks/github-gem.rake tasks/request_log_analyzer.rake)
|
|
43
|
+
s.test_files = %w(spec/integration/command_line_usage_spec.rb spec/integration/mailer_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/integration/scout_spec.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/controller/controller_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/database/base_class_spec.rb spec/unit/database/connection_spec.rb spec/unit/database/database_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/file_format/apache_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/delayed_job21_format_spec.rb spec/unit/file_format/delayed_job2_format_spec.rb spec/unit/file_format/delayed_job_format_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/haproxy_format_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/file_format/oink_format_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/unit/file_format/rails_format_spec.rb spec/unit/file_format/w3c_format_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/filter/filter_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/mailer_spec.rb spec/unit/request_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/tracker/traffic_tracker_spec.rb)
|
|
41
44
|
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Jun 18 11:27:37 derek rails[67783]: Processing FileRecordsController#inline (for 127.0.0.1 at 2010-06-18 11:27:37) [GET]
|
|
2
|
+
Jun 18 11:27:37 derek rails[67783]: Session ID: 8abbd5bce47cfc8bd438c647f5a9e016
|
|
3
|
+
Jun 18 11:27:37 derek rails[67783]: Parameters: {"id"=>"5171"}
|
|
4
|
+
Jun 18 11:27:37 derek rails[67783]: Memory usage: 400000 | PID: 67783
|
|
5
|
+
Jun 18 11:27:37 derek rails[67783]: Completed in 207ms (View: 0, DB: 258) | 200 OK [http://localhost/file_records/inline/5171]
|
|
6
|
+
|
|
7
|
+
Jun 18 11:28:11 derek rails[700]: Processing InfoController#about (for 127.0.0.1 at 2010-06-18 11:28:11) [GET]
|
|
8
|
+
Jun 18 11:28:12 derek rails[700]: Memory usage: 700000 | PID: 67783
|
|
9
|
+
Jun 18 11:28:12 derek rails[700]: Completed in 379ms (View: 89, DB: 258) | 200 OK [http://localhost/info/about]
|
|
10
|
+
|
|
11
|
+
Jun 18 11:28:11 derek rails[700]: Processing InfoController#board (for 127.0.0.1 at 2010-06-18 11:28:11) [GET]
|
|
12
|
+
Jun 18 11:28:12 derek rails[700]: Memory usage: 750000 | PID: 67783
|
|
13
|
+
Jun 18 11:28:12 derek rails[700]: Completed in 379ms (View: 89, DB: 258) | 200 OK [http://localhost/info/board]
|
|
14
|
+
|
|
15
|
+
Jun 18 11:31:19 derek rails[67783]: Processing InnovationsController#innovation_param (for 127.0.0.1 at 2010-06-18 11:31:19) [GET]
|
|
16
|
+
Jun 18 11:31:19 derek rails[67783]: Session ID: 8abbd5bce47cfc8bd438c647f5a9e016
|
|
17
|
+
Jun 18 11:31:19 derek rails[67783]: Parameters: {"organization_param"=>"harvard", "innovation_param"=>"potent-ogt-inhibitors-for-the-treatment-of-cancer-and-diabeti"}
|
|
18
|
+
Jun 18 11:31:31 derek rails[67783]: Memory usage: 430000 | PID: 67783
|
|
19
|
+
Jun 18 11:31:31 derek rails[67783]: Completed in 11922ms (View: 200, DB: 11673) | 200 OK [http://localhost/harvard/potent-ogt-inhibitors-for-the-treatment-of-cancer-and-diabeti]
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
Jun 18 11:25:37 derek rails[67783]: Processing FileRecordsController#inline (for 127.0.0.1 at 2010-06-18 11:25:37) [GET]
|
|
2
|
+
Jun 18 11:25:40 derek rails[67783]: NoMethodError (undefined method `update_domain_account' for nil:NilClass):
|
|
3
|
+
|
|
4
|
+
Jun 18 11:27:37 derek rails[67783]: Processing FileRecordsController#inline (for 127.0.0.1 at 2010-06-18 11:27:37) [GET]
|
|
5
|
+
Jun 18 11:27:37 derek rails[67783]: Session ID: 8abbd5bce47cfc8bd438c647f5a9e016
|
|
6
|
+
Jun 18 11:27:37 derek rails[67783]: Parameters: {"id"=>"5171"}
|
|
7
|
+
Jun 18 11:27:37 derek rails[67783]: Memory usage: 400000 | PID: 67783
|
|
8
|
+
Jun 18 11:27:37 derek rails[67783]: Completed in 207ms (View: 0, DB: 258) | 200 OK [http://localhost/file_records/inline/5171]
|
|
9
|
+
|
|
10
|
+
Jun 18 11:30:37 derek rails[67783]: Processing FileRecordsController#inline (for 127.0.0.1 at 2010-06-18 11:27:37) [GET]
|
|
11
|
+
Jun 18 11:30:40 derek rails[67783]: NoMethodError (undefined method `update_domain_account' for nil:NilClass):
|
|
12
|
+
|
|
13
|
+
Jun 18 11:31:19 derek rails[67783]: Processing InnovationsController#innovation_param (for 127.0.0.1 at 2010-06-18 11:31:19) [GET]
|
|
14
|
+
Jun 18 11:31:19 derek rails[67783]: Session ID: 8abbd5bce47cfc8bd438c647f5a9e016
|
|
15
|
+
Jun 18 11:31:19 derek rails[67783]: Parameters: {"organization_param"=>"harvard", "innovation_param"=>"potent-ogt-inhibitors-for-the-treatment-of-cancer-and-diabeti"}
|
|
16
|
+
Jun 18 11:31:31 derek rails[67783]: Memory usage: 430000 | PID: 67783
|
|
17
|
+
Jun 18 11:31:31 derek rails[67783]: Completed in 11922ms (View: 200, DB: 11673) | 200 OK [http://localhost/harvard/potent-ogt-inhibitors-for-the-treatment-of-cancer-and-diabeti]
|