request-log-analyzer 1.6.4 → 1.7.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.
@@ -57,6 +57,8 @@ begin
57
57
 
58
58
  command_line.switch(:debug)
59
59
  command_line.switch(:no_progress)
60
+ command_line.switch(:gets_memory_protection)
61
+ command_line.switch(:silent)
60
62
 
61
63
  command_line.minimum_parameters = 1
62
64
  end
@@ -87,6 +89,7 @@ rescue CommandLine::Error => e
87
89
  puts " --output <format> Output format. Supports 'html' and 'fixed_width'."
88
90
  puts " --report-width <amount> Width of ASCII report. Defaults to terminal width."
89
91
  puts " --report-amount <amount> Maximum numer of results per report."
92
+ puts " --silent Skip the commercials (includes --no-progress)."
90
93
  puts " --yaml <filename> Dump the results in YAML format in the given file."
91
94
  puts
92
95
  puts "Examples:"
@@ -112,9 +115,11 @@ when :strip
112
115
  require File.dirname(__FILE__) + '/../lib/request_log_analyzer/log_processor'
113
116
  RequestLogAnalyzer::LogProcessor.build(:strip, arguments).run!
114
117
  else
115
- puts "Request-log-analyzer, by Willem van Bergen and Bart ten Brinke - version #{RequestLogAnalyzer::VERSION}"
116
- puts "Website: http://railsdoctors.com"
117
- puts
118
+ unless arguments[:silent]
119
+ puts "Request-log-analyzer, by Willem van Bergen and Bart ten Brinke - version #{RequestLogAnalyzer::VERSION}"
120
+ puts "Website: http://railsdoctors.com"
121
+ puts
122
+ end
118
123
 
119
124
  # Run the request_log_analyzer!
120
125
  RequestLogAnalyzer::Controller.build_from_arguments(arguments).run!
@@ -0,0 +1,80 @@
1
+ class File
2
+ alias_method :gets_original, :gets
3
+ # The size of the reads we will use to add to the line buffer.
4
+ MAX_READ_SIZE=1024*100
5
+
6
+ #
7
+ # This method returns the next line of the File.
8
+ #
9
+ # It works by moving the file pointer forward +MAX_READ_SIZE+ at a time,
10
+ # storing seen lines in <tt>@line_buffer</tt>. Once the buffer contains at
11
+ # least two lines (ensuring we have seen on full line) or the file pointer
12
+ # reaches the end of the File, the last line from the buffer is returned.
13
+ # When the buffer is exhausted, this will throw +nil+ (from the empty Array).
14
+ #
15
+ # Read portions of the file that do not contain the +sep_string+ are not added to
16
+ # the buffer. This prevents <tt>@line_buffer<tt> from growing signficantly when parsing
17
+ # large lines.
18
+ #
19
+ def gets(sep_string = $/)
20
+ @read_size ||= MAX_READ_SIZE
21
+ # A buffer to hold lines read, but not yet returned.
22
+ @line_buffer ||= Array.new
23
+
24
+ # Record where we are.
25
+ @current_pos ||= pos
26
+
27
+ # Last Position in the file
28
+ @last_pos ||= nil
29
+ if @last_pos.nil?
30
+ seek(0, IO::SEEK_END)
31
+ @last_pos = pos
32
+ seek(0,0)
33
+ end
34
+
35
+ #
36
+ # If we have more than one line in the buffer or we have reached the
37
+ # beginning of the file, send the last line in the buffer to the caller.
38
+ # (This may be +nil+, if the buffer has been exhausted.)
39
+ #
40
+ if @line_buffer.size > 2 or @current_pos >= @last_pos
41
+ self.lineno += 1
42
+ return @line_buffer.shift
43
+ end
44
+
45
+ sep =
46
+
47
+ chunk = String.new
48
+ while chunk and chunk !~ /#{sep_string}/
49
+ chunk = read(@read_size)
50
+ end
51
+
52
+ # Appends new lines to the last element of the buffer
53
+ line_buffer_pos = @line_buffer.any? ? @line_buffer.size-1 : 0
54
+
55
+ if chunk
56
+ @line_buffer[line_buffer_pos] = @line_buffer[line_buffer_pos].to_s<< chunk
57
+ else
58
+ # at the end
59
+ return @line_buffer.shift
60
+ end
61
+
62
+ #
63
+ # Divide the last line of the buffer based on +sep_string+ and #flatten!
64
+ # those new lines into the buffer.
65
+ #
66
+ @line_buffer[line_buffer_pos] = @line_buffer[line_buffer_pos].scan(/.*?#{Regexp.escape(sep_string)}|.+/)
67
+ @line_buffer.flatten!
68
+
69
+ #
70
+ # If we made it this far, we need to read more data to try and find the
71
+ # end of a line or the end of the file. Move the file pointer
72
+ # forward a step, to give us new bytes to read.
73
+ #
74
+ @current_pos += @read_size
75
+ seek(@current_pos, IO::SEEK_SET)
76
+
77
+ # We have more data now, so try again to read a line...
78
+ gets(sep_string)
79
+ end
80
+ end
@@ -11,7 +11,7 @@ module RequestLogAnalyzer
11
11
 
12
12
  # The current version of request-log-analyzer.
13
13
  # Do not change the value by hand; it will be updated automatically by the gem release script.
14
- VERSION = "1.6.4"
14
+ VERSION = "1.7.0"
15
15
 
16
16
  # Loads constants in the RequestLogAnalyzer namespace using self.load_default_class_file(base, const)
17
17
  # <tt>const</tt>:: The constant that is not yet loaded in the RequestLogAnalyzer namespace. This should be passed as a string or symbol.
@@ -21,6 +21,8 @@ module RequestLogAnalyzer
21
21
  # <tt>arguments<tt> A CommandLine::Arguments hash containing parsed commandline parameters.
22
22
  def self.build_from_arguments(arguments)
23
23
 
24
+ require 'lib/mixins/gets_memory_protection' if arguments[:gets_memory_protection]
25
+
24
26
  options = {}
25
27
 
26
28
  # Copy fields
@@ -43,6 +45,7 @@ module RequestLogAnalyzer
43
45
  options[:report_sort] = arguments[:report_sort]
44
46
  options[:report_amount] = arguments[:report_amount]
45
47
  options[:mailhost] = arguments[:mailhost]
48
+ options[:silent] = arguments[:silent]
46
49
 
47
50
  # Apache format workaround
48
51
  if arguments[:rails_format]
@@ -112,6 +115,7 @@ module RequestLogAnalyzer
112
115
  # * <tt>:select</tt> Select specific {:field => :value} combination (expects a single hash).
113
116
  # * <tt>:source_files</tt> Source files to analyze. Provide either File, array of files or STDIN.
114
117
  # * <tt>:yaml</tt> Output to YAML file.
118
+ # * <tt>:silent</tt> Minimal output automatically implies :no_progress
115
119
  #
116
120
  # === Example
117
121
  # RequestLogAnalyzer::Controller.build(
@@ -133,6 +137,9 @@ module RequestLogAnalyzer
133
137
  options[:report_amount] ||= 20
134
138
  options[:report_sort] ||= 'sum,mean'
135
139
  options[:boring] ||= false
140
+ options[:silent] ||= false
141
+
142
+ options[:no_progress] = true if options[:silent]
136
143
 
137
144
  # Deprecation warnings
138
145
  if options[:dump]
@@ -179,7 +186,9 @@ module RequestLogAnalyzer
179
186
  :database => options[:database], # FUGLY!
180
187
  :yaml => options[:yaml],
181
188
  :reset_database => options[:reset_database],
182
- :no_progress => options[:no_progress]})
189
+ :no_progress => options[:no_progress],
190
+ :silent => options[:silent],
191
+ })
183
192
 
184
193
  # register filters
185
194
  if options[:after] || options[:before]
@@ -224,6 +233,7 @@ module RequestLogAnalyzer
224
233
  # * <tt>:yaml</tt> Yaml Dump the contrller should use.
225
234
  # * <tt>:output</tt> All report outputs get << through this output.
226
235
  # * <tt>:no_progress</tt> No progress bar
236
+ # * <tt>:silent</tt> Minimal output, only error
227
237
  def initialize(source, options = {})
228
238
 
229
239
  @source = source
@@ -331,11 +341,13 @@ module RequestLogAnalyzer
331
341
  @source.finalize
332
342
 
333
343
  if @output.io.kind_of?(File)
334
- puts
335
- puts "Report written to: " + File.expand_path(@output.io.path)
336
- puts "Need an expert to analyze your application?"
337
- puts "Mail to contact@railsdoctors.com or visit us at http://railsdoctors.com"
338
- puts "Thanks for using request-log-analyzer!"
344
+ unless @options[:silent]
345
+ puts
346
+ puts "Report written to: " + File.expand_path(@output.io.path)
347
+ puts "Need an expert to analyze your application?"
348
+ puts "Mail to contact@railsdoctors.com or visit us at http://railsdoctors.com"
349
+ puts "Thanks for using request-log-analyzer!"
350
+ end
339
351
  @output.io.close
340
352
  elsif @output.io.kind_of?(RequestLogAnalyzer::Mailer)
341
353
  @output.io.mail
@@ -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.4"
6
- s.date = "2010-03-22"
5
+ s.version = "1.7.0"
6
+ s.date = "2010-04-28"
7
7
 
8
8
  s.rubyforge_project = 'r-l-a'
9
9
 
@@ -36,6 +36,6 @@ Gem::Specification.new do |s|
36
36
 
37
37
  # The files and test_files directives are set automatically by the release script.
38
38
  # Do not change them by hand, but make sure to add the files to the git repository.
39
- s.files = %w(spec/unit/tracker/hourly_spread_spec.rb lib/request_log_analyzer/output/html.rb DESIGN.rdoc spec/fixtures/rails_unordered.log spec/fixtures/multiple_files_1.log lib/request_log_analyzer/database/source.rb README.rdoc spec/unit/file_format/amazon_s3_format_spec.rb lib/request_log_analyzer/file_format/rails_development.rb spec/fixtures/rails_22.log spec/fixtures/test_order.log spec/unit/database/base_class_spec.rb lib/request_log_analyzer/database/connection.rb lib/request_log_analyzer/aggregator.rb spec/fixtures/decompression.log lib/request_log_analyzer/file_format/apache.rb spec/unit/file_format/rack_format_spec.rb spec/fixtures/decompression.log.gz lib/request_log_analyzer/tracker/frequency.rb lib/request_log_analyzer/tracker/duration.rb tasks/github-gem.rake spec/unit/filter/filter_spec.rb .gitignore spec/lib/macros.rb spec/spec_helper.rb spec/fixtures/decompression.log.bz2 spec/unit/database/connection_spec.rb lib/request_log_analyzer/filter.rb spec/integration/scout_spec.rb spec/fixtures/test_file_format.log spec/unit/filter/timespan_filter_spec.rb lib/request_log_analyzer/tracker/traffic.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/file_format_api_spec.rb lib/request_log_analyzer/filter/field.rb lib/request_log_analyzer/file_format/merb.rb lib/request_log_analyzer/filter/anonymize.rb lib/request_log_analyzer/file_format/amazon_s3.rb lib/cli/database_console.rb spec/integration/mailer_spec.rb lib/request_log_analyzer/line_definition.rb spec/unit/tracker/frequency_tracker_spec.rb spec/fixtures/postgresql.log spec/fixtures/multiple_files_2.log spec/lib/mocks.rb spec/unit/file_format/apache_format_spec.rb spec/fixtures/syslog_1x.log spec/unit/file_format/rails3_format_spec.rb spec/integration/munin_plugins_rails_spec.rb lib/request_log_analyzer/file_format/rails3.rb spec/lib/helpers.rb spec/unit/file_format/delayed_job_format_spec.rb spec/fixtures/rails.db spec/unit/source/log_parser_spec.rb lib/request_log_analyzer/aggregator/database_inserter.rb spec/fixtures/header_and_footer.log spec/lib/testing_format.rb lib/request_log_analyzer/database.rb spec/unit/file_format/rails_format_spec.rb lib/request_log_analyzer/request.rb lib/request_log_analyzer/output/fixed_width.rb spec/integration/command_line_usage_spec.rb lib/request_log_analyzer/file_format/rack.rb lib/request_log_analyzer/tracker/numeric_value.rb spec/fixtures/test_language_combined.log spec/unit/request_spec.rb lib/cli/command_line_arguments.rb lib/request_log_analyzer.rb spec/database.yml lib/request_log_analyzer/database/base.rb spec/unit/aggregator/database_inserter_spec.rb lib/request_log_analyzer/database/request.rb lib/request_log_analyzer/output/fancy_html.rb lib/cli/database_console_init.rb lib/cli/progressbar.rb lib/request_log_analyzer/database/warning.rb spec/unit/filter/anonymize_filter_spec.rb spec/fixtures/apache_combined.log spec/unit/tracker/duration_tracker_spec.rb spec/fixtures/rails_22_cached.log lib/request_log_analyzer/aggregator/summarizer.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/fixtures/rails_1x.log lib/request_log_analyzer/file_format/delayed_job.rb lib/request_log_analyzer/output.rb spec/unit/file_format/line_definition_spec.rb lib/request_log_analyzer/file_format/mysql.rb spec/unit/file_format/mysql_format_spec.rb request-log-analyzer.gemspec spec/fixtures/apache_common.log spec/unit/mailer_spec.rb lib/request_log_analyzer/file_format/rails.rb Rakefile lib/request_log_analyzer/tracker/hourly_spread.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/tracker/traffic_tracker_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb lib/request_log_analyzer/file_format/postgresql.rb lib/request_log_analyzer/tracker/timespan.rb spec/unit/controller/log_processor_spec.rb spec/unit/filter/field_filter_spec.rb spec/fixtures/sinatra.log spec/fixtures/merb_prefixed.log lib/request_log_analyzer/log_processor.rb lib/request_log_analyzer/filter/timespan.rb spec/unit/controller/controller_spec.rb lib/request_log_analyzer/mailer.rb lib/cli/tools.rb spec/fixtures/decompression.tar.gz spec/unit/tracker/timespan_tracker_spec.rb spec/lib/matchers.rb lib/request_log_analyzer/controller.rb spec/unit/tracker/tracker_api_spec.rb lib/request_log_analyzer/source/database_loader.rb spec/fixtures/merb.log LICENSE lib/request_log_analyzer/file_format.rb tasks/request_log_analyzer.rake spec/unit/database/database_spec.rb spec/fixtures/decompression.log.zip spec/fixtures/decompression.tgz bin/request-log-analyzer lib/request_log_analyzer/tracker.rb lib/request_log_analyzer/source.rb spec/fixtures/mysql_slow_query.log lib/request_log_analyzer/source/log_parser.rb lib/request_log_analyzer/aggregator/echo.rb)
40
- s.test_files = %w(spec/unit/tracker/hourly_spread_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/database/base_class_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/filter/filter_spec.rb spec/unit/database/connection_spec.rb spec/integration/scout_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/integration/mailer_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/file_format/apache_format_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/unit/file_format/delayed_job_format_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/file_format/rails_format_spec.rb spec/integration/command_line_usage_spec.rb spec/unit/request_spec.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/mailer_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/tracker/traffic_tracker_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/controller/controller_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/database/database_spec.rb)
39
+ s.files = %w(spec/unit/file_format/delayed_job_format_spec.rb spec/fixtures/rails_unordered.log spec/unit/filter/anonymize_filter_spec.rb lib/request_log_analyzer/output/fancy_html.rb README.rdoc lib/cli/progressbar.rb spec/fixtures/rails.db lib/request_log_analyzer/file_format/rails_development.rb spec/fixtures/rails_22.log spec/fixtures/test_order.log spec/fixtures/header_and_footer.log lib/mixins/gets_memory_protection.rb spec/fixtures/decompression.log spec/fixtures/rails_1x.log lib/request_log_analyzer/file_format/apache.rb lib/request_log_analyzer/output.rb lib/request_log_analyzer/tracker/numeric_value.rb spec/unit/file_format/line_definition_spec.rb spec/unit/request_spec.rb spec/unit/filter/filter_spec.rb spec/unit/aggregator/summarizer_spec.rb lib/request_log_analyzer/file_format/rails.rb spec/database.yml spec/unit/tracker/numeric_value_tracker_spec.rb spec/spec_helper.rb lib/request_log_analyzer/database/base.rb spec/unit/aggregator/database_inserter_spec.rb spec/fixtures/decompression.log.bz2 spec/unit/database/connection_spec.rb spec/fixtures/sinatra.log lib/request_log_analyzer/database/warning.rb spec/fixtures/merb_prefixed.log spec/unit/file_format/postgresql_format_spec.rb lib/request_log_analyzer/filter/timespan.rb spec/fixtures/rails_22_cached.log lib/request_log_analyzer/tracker/traffic.rb spec/unit/file_format/format_autodetection_spec.rb lib/request_log_analyzer/filter/field.rb lib/request_log_analyzer/file_format/delayed_job.rb lib/request_log_analyzer/file_format/merb.rb lib/request_log_analyzer/filter/anonymize.rb lib/request_log_analyzer/file_format/amazon_s3.rb LICENSE lib/request_log_analyzer/file_format.rb lib/cli/database_console.rb spec/integration/mailer_spec.rb spec/fixtures/merb.log lib/request_log_analyzer/line_definition.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/mailer_spec.rb spec/fixtures/postgresql.log spec/lib/mocks.rb lib/request_log_analyzer/tracker/hourly_spread.rb spec/fixtures/syslog_1x.log spec/unit/file_format/rails3_format_spec.rb lib/request_log_analyzer/source.rb lib/request_log_analyzer/file_format/rails3.rb spec/unit/controller/log_processor_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/filter/field_filter_spec.rb DESIGN.rdoc lib/request_log_analyzer/log_processor.rb spec/fixtures/multiple_files_1.log spec/unit/source/log_parser_spec.rb spec/fixtures/decompression.tar.gz spec/unit/database/base_class_spec.rb lib/request_log_analyzer/aggregator/database_inserter.rb lib/request_log_analyzer/database/connection.rb lib/request_log_analyzer/aggregator.rb lib/request_log_analyzer/database.rb spec/unit/file_format/rails_format_spec.rb lib/request_log_analyzer/source/database_loader.rb lib/request_log_analyzer/output/fixed_width.rb spec/integration/command_line_usage_spec.rb tasks/request_log_analyzer.rake lib/request_log_analyzer/tracker/duration.rb spec/fixtures/test_language_combined.log bin/request-log-analyzer lib/request_log_analyzer/tracker.rb tasks/github-gem.rake lib/cli/command_line_arguments.rb lib/request_log_analyzer.rb .gitignore lib/request_log_analyzer/output/html.rb lib/request_log_analyzer/database/request.rb lib/cli/database_console_init.rb lib/request_log_analyzer/database/source.rb spec/unit/file_format/amazon_s3_format_spec.rb lib/request_log_analyzer/filter.rb spec/fixtures/apache_combined.log spec/unit/tracker/duration_tracker_spec.rb spec/fixtures/test_file_format.log lib/request_log_analyzer/aggregator/summarizer.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/file_format_api_spec.rb lib/request_log_analyzer/file_format/mysql.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/fixtures/decompression.log.gz lib/request_log_analyzer/tracker/frequency.rb request-log-analyzer.gemspec spec/fixtures/apache_common.log Rakefile spec/unit/tracker/traffic_tracker_spec.rb lib/request_log_analyzer/file_format/postgresql.rb lib/request_log_analyzer/tracker/timespan.rb spec/lib/macros.rb spec/integration/scout_spec.rb spec/unit/controller/controller_spec.rb lib/request_log_analyzer/mailer.rb lib/cli/tools.rb spec/unit/tracker/timespan_tracker_spec.rb spec/lib/testing_format.rb spec/lib/matchers.rb lib/request_log_analyzer/controller.rb spec/unit/tracker/tracker_api_spec.rb lib/request_log_analyzer/request.rb spec/fixtures/multiple_files_2.log spec/unit/database/database_spec.rb spec/fixtures/decompression.log.zip spec/fixtures/decompression.tgz lib/request_log_analyzer/file_format/rack.rb spec/integration/munin_plugins_rails_spec.rb spec/fixtures/mysql_slow_query.log spec/lib/helpers.rb lib/request_log_analyzer/source/log_parser.rb lib/request_log_analyzer/aggregator/echo.rb spec/unit/file_format/apache_format_spec.rb)
40
+ s.test_files = %w(spec/unit/file_format/delayed_job_format_spec.rb spec/unit/filter/anonymize_filter_spec.rb spec/unit/file_format/line_definition_spec.rb spec/unit/request_spec.rb spec/unit/filter/filter_spec.rb spec/unit/aggregator/summarizer_spec.rb spec/unit/tracker/numeric_value_tracker_spec.rb spec/unit/aggregator/database_inserter_spec.rb spec/unit/database/connection_spec.rb spec/unit/file_format/postgresql_format_spec.rb spec/unit/file_format/format_autodetection_spec.rb spec/integration/mailer_spec.rb spec/unit/tracker/frequency_tracker_spec.rb spec/unit/mailer_spec.rb spec/unit/file_format/rails3_format_spec.rb spec/unit/controller/log_processor_spec.rb spec/unit/tracker/hourly_spread_spec.rb spec/unit/filter/field_filter_spec.rb spec/unit/source/log_parser_spec.rb spec/unit/database/base_class_spec.rb spec/unit/file_format/rails_format_spec.rb spec/integration/command_line_usage_spec.rb spec/unit/file_format/amazon_s3_format_spec.rb spec/unit/tracker/duration_tracker_spec.rb spec/unit/filter/timespan_filter_spec.rb spec/unit/file_format/common_regular_expressions_spec.rb spec/unit/file_format/merb_format_spec.rb spec/unit/file_format/file_format_api_spec.rb spec/unit/file_format/rack_format_spec.rb spec/unit/file_format/mysql_format_spec.rb spec/unit/tracker/traffic_tracker_spec.rb spec/integration/scout_spec.rb spec/unit/controller/controller_spec.rb spec/unit/tracker/timespan_tracker_spec.rb spec/unit/tracker/tracker_api_spec.rb spec/unit/database/database_spec.rb spec/integration/munin_plugins_rails_spec.rb spec/unit/file_format/apache_format_spec.rb)
41
41
  end
@@ -15,6 +15,11 @@ describe RequestLogAnalyzer, 'running from command line' do
15
15
  output.any? { |line| /^Parsed requests\:\s*4\s/ =~ line }.should be_true
16
16
  end
17
17
 
18
+ it "should function correctly with the gets mixin" do
19
+ output = run("#{log_fixture(:rails_1x)} --gets-memory-protection")
20
+ output.any? { |line| /^Parsed requests\:\s*4\s/ =~ line }.should be_true
21
+ end
22
+
18
23
  it "should find 2 requests when parsing a compressed file" do
19
24
  output = run("#{log_fixture(:decompression, :tgz)}")
20
25
  output.any? { |line| /^Parsed requests\:\s*2\s/ =~ line }.should be_true
@@ -31,6 +36,12 @@ describe RequestLogAnalyzer, 'running from command line' do
31
36
  output.any? { |line| /^Skipped requests\:\s*3\s/ =~ line }.should be_true
32
37
  end
33
38
 
39
+ it "should not write output with the --silent option" do
40
+ output = run("#{log_fixture(:rails_1x)} --silent --file #{temp_output_file(:report)}")
41
+ output.to_s.should eql("")
42
+ File.exist?(temp_output_file(:report)).should be_true
43
+ end
44
+
34
45
  it "should write output to a file with the --file option" do
35
46
  run("#{log_fixture(:rails_1x)} --file #{temp_output_file(:report)}")
36
47
  File.exist?(temp_output_file(:report)).should be_true
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 1
7
- - 6
8
- - 4
9
- version: 1.6.4
7
+ - 7
8
+ - 0
9
+ version: 1.7.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Willem van Bergen
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2010-03-22 00:00:00 -04:00
18
+ date: 2010-04-28 00:00:00 +02:00
19
19
  default_executable: request-log-analyzer
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -57,135 +57,136 @@ extensions: []
57
57
  extra_rdoc_files:
58
58
  - README.rdoc
59
59
  files:
60
- - spec/unit/tracker/hourly_spread_spec.rb
61
- - lib/request_log_analyzer/output/html.rb
62
- - DESIGN.rdoc
60
+ - spec/unit/file_format/delayed_job_format_spec.rb
63
61
  - spec/fixtures/rails_unordered.log
64
- - spec/fixtures/multiple_files_1.log
65
- - lib/request_log_analyzer/database/source.rb
62
+ - spec/unit/filter/anonymize_filter_spec.rb
63
+ - lib/request_log_analyzer/output/fancy_html.rb
66
64
  - README.rdoc
67
- - spec/unit/file_format/amazon_s3_format_spec.rb
65
+ - lib/cli/progressbar.rb
66
+ - spec/fixtures/rails.db
68
67
  - lib/request_log_analyzer/file_format/rails_development.rb
69
68
  - spec/fixtures/rails_22.log
70
69
  - spec/fixtures/test_order.log
71
- - spec/unit/database/base_class_spec.rb
72
- - lib/request_log_analyzer/database/connection.rb
73
- - lib/request_log_analyzer/aggregator.rb
70
+ - spec/fixtures/header_and_footer.log
71
+ - lib/mixins/gets_memory_protection.rb
74
72
  - spec/fixtures/decompression.log
73
+ - spec/fixtures/rails_1x.log
75
74
  - lib/request_log_analyzer/file_format/apache.rb
76
- - spec/unit/file_format/rack_format_spec.rb
77
- - spec/fixtures/decompression.log.gz
78
- - lib/request_log_analyzer/tracker/frequency.rb
79
- - lib/request_log_analyzer/tracker/duration.rb
80
- - tasks/github-gem.rake
75
+ - lib/request_log_analyzer/output.rb
76
+ - lib/request_log_analyzer/tracker/numeric_value.rb
77
+ - spec/unit/file_format/line_definition_spec.rb
78
+ - spec/unit/request_spec.rb
81
79
  - spec/unit/filter/filter_spec.rb
82
- - .gitignore
83
- - spec/lib/macros.rb
80
+ - spec/unit/aggregator/summarizer_spec.rb
81
+ - lib/request_log_analyzer/file_format/rails.rb
82
+ - spec/database.yml
83
+ - spec/unit/tracker/numeric_value_tracker_spec.rb
84
84
  - spec/spec_helper.rb
85
+ - lib/request_log_analyzer/database/base.rb
86
+ - spec/unit/aggregator/database_inserter_spec.rb
85
87
  - spec/fixtures/decompression.log.bz2
86
88
  - spec/unit/database/connection_spec.rb
87
- - lib/request_log_analyzer/filter.rb
88
- - spec/integration/scout_spec.rb
89
- - spec/fixtures/test_file_format.log
90
- - spec/unit/filter/timespan_filter_spec.rb
89
+ - spec/fixtures/sinatra.log
90
+ - lib/request_log_analyzer/database/warning.rb
91
+ - spec/fixtures/merb_prefixed.log
92
+ - spec/unit/file_format/postgresql_format_spec.rb
93
+ - lib/request_log_analyzer/filter/timespan.rb
94
+ - spec/fixtures/rails_22_cached.log
91
95
  - lib/request_log_analyzer/tracker/traffic.rb
92
- - spec/unit/file_format/merb_format_spec.rb
93
96
  - spec/unit/file_format/format_autodetection_spec.rb
94
- - spec/unit/file_format/file_format_api_spec.rb
95
97
  - lib/request_log_analyzer/filter/field.rb
98
+ - lib/request_log_analyzer/file_format/delayed_job.rb
96
99
  - lib/request_log_analyzer/file_format/merb.rb
97
100
  - lib/request_log_analyzer/filter/anonymize.rb
98
101
  - lib/request_log_analyzer/file_format/amazon_s3.rb
102
+ - LICENSE
103
+ - lib/request_log_analyzer/file_format.rb
99
104
  - lib/cli/database_console.rb
100
105
  - spec/integration/mailer_spec.rb
106
+ - spec/fixtures/merb.log
101
107
  - lib/request_log_analyzer/line_definition.rb
102
108
  - spec/unit/tracker/frequency_tracker_spec.rb
109
+ - spec/unit/mailer_spec.rb
103
110
  - spec/fixtures/postgresql.log
104
- - spec/fixtures/multiple_files_2.log
105
111
  - spec/lib/mocks.rb
106
- - spec/unit/file_format/apache_format_spec.rb
112
+ - lib/request_log_analyzer/tracker/hourly_spread.rb
107
113
  - spec/fixtures/syslog_1x.log
108
114
  - spec/unit/file_format/rails3_format_spec.rb
109
- - spec/integration/munin_plugins_rails_spec.rb
115
+ - lib/request_log_analyzer/source.rb
110
116
  - lib/request_log_analyzer/file_format/rails3.rb
111
- - spec/lib/helpers.rb
112
- - spec/unit/file_format/delayed_job_format_spec.rb
113
- - spec/fixtures/rails.db
117
+ - spec/unit/controller/log_processor_spec.rb
118
+ - spec/unit/tracker/hourly_spread_spec.rb
119
+ - spec/unit/filter/field_filter_spec.rb
120
+ - DESIGN.rdoc
121
+ - lib/request_log_analyzer/log_processor.rb
122
+ - spec/fixtures/multiple_files_1.log
114
123
  - spec/unit/source/log_parser_spec.rb
124
+ - spec/fixtures/decompression.tar.gz
125
+ - spec/unit/database/base_class_spec.rb
115
126
  - lib/request_log_analyzer/aggregator/database_inserter.rb
116
- - spec/fixtures/header_and_footer.log
117
- - spec/lib/testing_format.rb
127
+ - lib/request_log_analyzer/database/connection.rb
128
+ - lib/request_log_analyzer/aggregator.rb
118
129
  - lib/request_log_analyzer/database.rb
119
130
  - spec/unit/file_format/rails_format_spec.rb
120
- - lib/request_log_analyzer/request.rb
131
+ - lib/request_log_analyzer/source/database_loader.rb
121
132
  - lib/request_log_analyzer/output/fixed_width.rb
122
133
  - spec/integration/command_line_usage_spec.rb
123
- - lib/request_log_analyzer/file_format/rack.rb
124
- - lib/request_log_analyzer/tracker/numeric_value.rb
134
+ - tasks/request_log_analyzer.rake
135
+ - lib/request_log_analyzer/tracker/duration.rb
125
136
  - spec/fixtures/test_language_combined.log
126
- - spec/unit/request_spec.rb
137
+ - bin/request-log-analyzer
138
+ - lib/request_log_analyzer/tracker.rb
139
+ - tasks/github-gem.rake
127
140
  - lib/cli/command_line_arguments.rb
128
141
  - lib/request_log_analyzer.rb
129
- - spec/database.yml
130
- - lib/request_log_analyzer/database/base.rb
131
- - spec/unit/aggregator/database_inserter_spec.rb
142
+ - .gitignore
143
+ - lib/request_log_analyzer/output/html.rb
132
144
  - lib/request_log_analyzer/database/request.rb
133
- - lib/request_log_analyzer/output/fancy_html.rb
134
145
  - lib/cli/database_console_init.rb
135
- - lib/cli/progressbar.rb
136
- - lib/request_log_analyzer/database/warning.rb
137
- - spec/unit/filter/anonymize_filter_spec.rb
146
+ - lib/request_log_analyzer/database/source.rb
147
+ - spec/unit/file_format/amazon_s3_format_spec.rb
148
+ - lib/request_log_analyzer/filter.rb
138
149
  - spec/fixtures/apache_combined.log
139
150
  - spec/unit/tracker/duration_tracker_spec.rb
140
- - spec/fixtures/rails_22_cached.log
151
+ - spec/fixtures/test_file_format.log
141
152
  - lib/request_log_analyzer/aggregator/summarizer.rb
142
- - spec/unit/file_format/postgresql_format_spec.rb
153
+ - spec/unit/filter/timespan_filter_spec.rb
143
154
  - spec/unit/file_format/common_regular_expressions_spec.rb
144
- - spec/fixtures/rails_1x.log
145
- - lib/request_log_analyzer/file_format/delayed_job.rb
146
- - lib/request_log_analyzer/output.rb
147
- - spec/unit/file_format/line_definition_spec.rb
155
+ - spec/unit/file_format/merb_format_spec.rb
156
+ - spec/unit/file_format/file_format_api_spec.rb
148
157
  - lib/request_log_analyzer/file_format/mysql.rb
158
+ - spec/unit/file_format/rack_format_spec.rb
149
159
  - spec/unit/file_format/mysql_format_spec.rb
160
+ - spec/fixtures/decompression.log.gz
161
+ - lib/request_log_analyzer/tracker/frequency.rb
150
162
  - request-log-analyzer.gemspec
151
163
  - spec/fixtures/apache_common.log
152
- - spec/unit/mailer_spec.rb
153
- - lib/request_log_analyzer/file_format/rails.rb
154
164
  - Rakefile
155
- - lib/request_log_analyzer/tracker/hourly_spread.rb
156
- - spec/unit/aggregator/summarizer_spec.rb
157
165
  - spec/unit/tracker/traffic_tracker_spec.rb
158
- - spec/unit/tracker/numeric_value_tracker_spec.rb
159
166
  - lib/request_log_analyzer/file_format/postgresql.rb
160
167
  - lib/request_log_analyzer/tracker/timespan.rb
161
- - spec/unit/controller/log_processor_spec.rb
162
- - spec/unit/filter/field_filter_spec.rb
163
- - spec/fixtures/sinatra.log
164
- - spec/fixtures/merb_prefixed.log
165
- - lib/request_log_analyzer/log_processor.rb
166
- - lib/request_log_analyzer/filter/timespan.rb
168
+ - spec/lib/macros.rb
169
+ - spec/integration/scout_spec.rb
167
170
  - spec/unit/controller/controller_spec.rb
168
171
  - lib/request_log_analyzer/mailer.rb
169
172
  - lib/cli/tools.rb
170
- - spec/fixtures/decompression.tar.gz
171
173
  - spec/unit/tracker/timespan_tracker_spec.rb
174
+ - spec/lib/testing_format.rb
172
175
  - spec/lib/matchers.rb
173
176
  - lib/request_log_analyzer/controller.rb
174
177
  - spec/unit/tracker/tracker_api_spec.rb
175
- - lib/request_log_analyzer/source/database_loader.rb
176
- - spec/fixtures/merb.log
177
- - LICENSE
178
- - lib/request_log_analyzer/file_format.rb
179
- - tasks/request_log_analyzer.rake
178
+ - lib/request_log_analyzer/request.rb
179
+ - spec/fixtures/multiple_files_2.log
180
180
  - spec/unit/database/database_spec.rb
181
181
  - spec/fixtures/decompression.log.zip
182
182
  - spec/fixtures/decompression.tgz
183
- - bin/request-log-analyzer
184
- - lib/request_log_analyzer/tracker.rb
185
- - lib/request_log_analyzer/source.rb
183
+ - lib/request_log_analyzer/file_format/rack.rb
184
+ - spec/integration/munin_plugins_rails_spec.rb
186
185
  - spec/fixtures/mysql_slow_query.log
186
+ - spec/lib/helpers.rb
187
187
  - lib/request_log_analyzer/source/log_parser.rb
188
188
  - lib/request_log_analyzer/aggregator/echo.rb
189
+ - spec/unit/file_format/apache_format_spec.rb
189
190
  has_rdoc: true
190
191
  homepage: http://railsdoctors.com
191
192
  licenses: []
@@ -222,41 +223,41 @@ signing_key:
222
223
  specification_version: 3
223
224
  summary: A command line tool to analyze request logs for Apache, Rails, Merb, MySQL and other web application servers
224
225
  test_files:
225
- - spec/unit/tracker/hourly_spread_spec.rb
226
- - spec/unit/file_format/amazon_s3_format_spec.rb
227
- - spec/unit/database/base_class_spec.rb
228
- - spec/unit/file_format/rack_format_spec.rb
226
+ - spec/unit/file_format/delayed_job_format_spec.rb
227
+ - spec/unit/filter/anonymize_filter_spec.rb
228
+ - spec/unit/file_format/line_definition_spec.rb
229
+ - spec/unit/request_spec.rb
229
230
  - spec/unit/filter/filter_spec.rb
231
+ - spec/unit/aggregator/summarizer_spec.rb
232
+ - spec/unit/tracker/numeric_value_tracker_spec.rb
233
+ - spec/unit/aggregator/database_inserter_spec.rb
230
234
  - spec/unit/database/connection_spec.rb
231
- - spec/integration/scout_spec.rb
232
- - spec/unit/filter/timespan_filter_spec.rb
233
- - spec/unit/file_format/merb_format_spec.rb
235
+ - spec/unit/file_format/postgresql_format_spec.rb
234
236
  - spec/unit/file_format/format_autodetection_spec.rb
235
- - spec/unit/file_format/file_format_api_spec.rb
236
237
  - spec/integration/mailer_spec.rb
237
238
  - spec/unit/tracker/frequency_tracker_spec.rb
238
- - spec/unit/file_format/apache_format_spec.rb
239
+ - spec/unit/mailer_spec.rb
239
240
  - spec/unit/file_format/rails3_format_spec.rb
240
- - spec/integration/munin_plugins_rails_spec.rb
241
- - spec/unit/file_format/delayed_job_format_spec.rb
241
+ - spec/unit/controller/log_processor_spec.rb
242
+ - spec/unit/tracker/hourly_spread_spec.rb
243
+ - spec/unit/filter/field_filter_spec.rb
242
244
  - spec/unit/source/log_parser_spec.rb
245
+ - spec/unit/database/base_class_spec.rb
243
246
  - spec/unit/file_format/rails_format_spec.rb
244
247
  - spec/integration/command_line_usage_spec.rb
245
- - spec/unit/request_spec.rb
246
- - spec/unit/aggregator/database_inserter_spec.rb
247
- - spec/unit/filter/anonymize_filter_spec.rb
248
+ - spec/unit/file_format/amazon_s3_format_spec.rb
248
249
  - spec/unit/tracker/duration_tracker_spec.rb
249
- - spec/unit/file_format/postgresql_format_spec.rb
250
+ - spec/unit/filter/timespan_filter_spec.rb
250
251
  - spec/unit/file_format/common_regular_expressions_spec.rb
251
- - spec/unit/file_format/line_definition_spec.rb
252
+ - spec/unit/file_format/merb_format_spec.rb
253
+ - spec/unit/file_format/file_format_api_spec.rb
254
+ - spec/unit/file_format/rack_format_spec.rb
252
255
  - spec/unit/file_format/mysql_format_spec.rb
253
- - spec/unit/mailer_spec.rb
254
- - spec/unit/aggregator/summarizer_spec.rb
255
256
  - spec/unit/tracker/traffic_tracker_spec.rb
256
- - spec/unit/tracker/numeric_value_tracker_spec.rb
257
- - spec/unit/controller/log_processor_spec.rb
258
- - spec/unit/filter/field_filter_spec.rb
257
+ - spec/integration/scout_spec.rb
259
258
  - spec/unit/controller/controller_spec.rb
260
259
  - spec/unit/tracker/timespan_tracker_spec.rb
261
260
  - spec/unit/tracker/tracker_api_spec.rb
262
261
  - spec/unit/database/database_spec.rb
262
+ - spec/integration/munin_plugins_rails_spec.rb
263
+ - spec/unit/file_format/apache_format_spec.rb