erkki-production_log_analyzer 2009022401
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/History.txt +34 -0
- data/LICENSE.txt +27 -0
- data/Manifest.txt +18 -0
- data/README.txt +147 -0
- data/Rakefile +17 -0
- data/bin/action_errors +46 -0
- data/bin/action_grep +19 -0
- data/bin/pl_analyze +36 -0
- data/lib/production_log/action_grep.rb +42 -0
- data/lib/production_log/analyzer.rb +406 -0
- data/lib/production_log/parser.rb +178 -0
- data/test/test.syslog.0.14.x.log +5 -0
- data/test/test.syslog.1.2.shortname.log +5 -0
- data/test/test.syslog.empty.log +2 -0
- data/test/test.syslog.log +258 -0
- data/test/test_action_grep.rb +66 -0
- data/test/test_analyzer.rb +418 -0
- data/test/test_parser.rb +297 -0
- metadata +97 -0
data/test/test_parser.rb
ADDED
@@ -0,0 +1,297 @@
|
|
1
|
+
$TESTING = true
|
2
|
+
|
3
|
+
require 'tempfile'
|
4
|
+
require 'test/unit'
|
5
|
+
require 'stringio'
|
6
|
+
|
7
|
+
require 'production_log/parser'
|
8
|
+
|
9
|
+
class TestLogEntry < Test::Unit::TestCase
|
10
|
+
|
11
|
+
def setup
|
12
|
+
@entry = LogParser::LogEntry.new <<-EOF
|
13
|
+
Processing TwinklerController#index (for 81.109.96.173 at Wed Dec 01 16:01:56 CST 2004)
|
14
|
+
Parameters: {\"action\"=>\"index\", \"controller\"=>\"twinkler\"}
|
15
|
+
Browser Load First (0.001114) SELECT * FROM browsers WHERE ubid = 'ixsXHgUo7U9PJGgBzr7e9ocaDOc=' LIMIT 1
|
16
|
+
Goal Count (0.001762) SELECT COUNT(*) FROM goals WHERE browser_id = '96181' and is_active = 1
|
17
|
+
Rendering twinkler/index within layouts/default
|
18
|
+
Rendering layouts/default (200 OK)
|
19
|
+
Completed in 0.616122 (1 reqs/sec) | Rendering: 0.242475 (39%) | DB: 0.002876 (0%)
|
20
|
+
EOF
|
21
|
+
|
22
|
+
@kong_entry = LogParser::LogEntry.new <<-EOF
|
23
|
+
Completed in 0.57672 (1 reqs/sec) | Rendering: 0.47752 (82%) | DB: 0.08223 (14%) | Rows: 75 | Queries: 32 | Method: GET | Request Size: 0 | Request Type: unknown | Response Format: html | Response Size: 71604 | Processed: FeaturedGamesController#index | 200 OK [http://www.kongregatetrunk.com/]
|
24
|
+
EOF
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_parse
|
28
|
+
request = <<-EOF
|
29
|
+
Processing RssController#uber (for 67.18.200.5 at Mon Mar 07 00:00:25 CST 2005)
|
30
|
+
Parameters: {:id=>"author", :"rss/uber/author.html/uber/author"=>nil, :action=>"uber", :username=>"looch", :controller=>"rss"}
|
31
|
+
Cookie set: auth=dc%2FGUP20BwziF%2BApGecc0pXB0PF0obi55az63ubAFtsnOOdJPkhfJH2U09yuzQD3WtdmWnydLzFcRA78kwi7Gw%3D%3D; path=/; expires=Thu, 05 Mar 2015 06:00:25 GMT
|
32
|
+
Cookie set: ubid=kF05DqFH%2F9hRCOxTz%2Bfb8Q7UV%2FI%3D; path=/; expires=Thu, 05 Mar 2015 06:00:25 GMT
|
33
|
+
Browser Load (0.003963) SELECT * FROM browsers WHERE ubid = 'kF05DqFH/9hRCOxTz+fb8Q7UV/I=' LIMIT 1
|
34
|
+
Person Load (0.002445) SELECT * FROM people WHERE username = 'looch' AND active = '1' LIMIT 1
|
35
|
+
ProfileImage Load (0.001554) SELECT * FROM profile_images WHERE id = 2782 LIMIT 1
|
36
|
+
Rendering rss/rss2.0 (200 OK)
|
37
|
+
Completed in 0.034519 (28 reqs/sec) | Rendering: 0.011770 (34%) | DB: 0.007962 (23%)
|
38
|
+
EOF
|
39
|
+
request = request.split "\n"
|
40
|
+
|
41
|
+
entry = LogParser::LogEntry.new []
|
42
|
+
|
43
|
+
entry.parse request
|
44
|
+
assert_kind_of LogParser::LogEntry, entry
|
45
|
+
assert_equal "RssController#uber", entry.page
|
46
|
+
assert_equal 3, entry.queries.length
|
47
|
+
assert_equal ['Browser Load', 0.003963], entry.queries.first
|
48
|
+
assert_equal 0.034519, entry.request_time
|
49
|
+
end
|
50
|
+
|
51
|
+
def test_kong_style_page
|
52
|
+
assert_equal "FeaturedGamesController#index.html", @kong_entry.page
|
53
|
+
end
|
54
|
+
|
55
|
+
def test_bad_kong_entry
|
56
|
+
assert_nothing_raised do
|
57
|
+
bad = LogParser::LogEntry.new <<-EOF
|
58
|
+
Completed in 0.00904 (110 reqs/sec) | Rendering: 0.00572 (63%) | DB: 0.00093 (10%) | Rows: 2 | Queries: 2 | Guest | Method: GET | Request Size: 0 | Request Type: unknown | Response Format: Accept: application/xhtml+xml | Response Size: 8637 | Processed: MyCardsController#show | 200 OK [http://www.kongregate.com/accounts/orc22/cards/688263]
|
59
|
+
EOF
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
def test_row_count
|
64
|
+
assert_equal 75, @kong_entry.row_count
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_query_count
|
68
|
+
assert_equal 32, @kong_entry.query_count
|
69
|
+
end
|
70
|
+
|
71
|
+
def test_request_size
|
72
|
+
assert_equal 0, @kong_entry.request_size
|
73
|
+
end
|
74
|
+
|
75
|
+
def test_response_size
|
76
|
+
assert_equal 71604, @kong_entry.response_size
|
77
|
+
end
|
78
|
+
|
79
|
+
def test_page
|
80
|
+
assert_equal "TwinklerController#index", @entry.page
|
81
|
+
end
|
82
|
+
|
83
|
+
def test_ip
|
84
|
+
assert_equal "81.109.96.173", @entry.ip
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_time
|
88
|
+
assert_equal "Wed Dec 01 16:01:56 CST 2004", @entry.time
|
89
|
+
end
|
90
|
+
|
91
|
+
def test_queries
|
92
|
+
expected = []
|
93
|
+
expected << ["Browser Load First", 0.001114]
|
94
|
+
expected << ["Goal Count", 0.001762]
|
95
|
+
assert_equal expected, @entry.queries
|
96
|
+
end
|
97
|
+
|
98
|
+
def test_request_time
|
99
|
+
assert_equal 0.616122, @entry.request_time
|
100
|
+
|
101
|
+
@entry = LogParser::LogEntry.new "Processing TwinklerController#add_thing (for 144.164.232.114 at Wed Dec 01 16:01:56 CST 2004)
|
102
|
+
Completed in 0.261485 (3 reqs/sec) | DB: 0.009325 (3%)"
|
103
|
+
|
104
|
+
assert_equal 0.261485, @entry.request_time
|
105
|
+
end
|
106
|
+
|
107
|
+
def test_render_time
|
108
|
+
assert_equal 0.242475, @entry.render_time
|
109
|
+
|
110
|
+
@entry = LogParser::LogEntry.new "Processing TwinklerController#add_thing (for 144.164.232.114 at Wed Dec 01 16:01:56 CST 2004)
|
111
|
+
Completed in 0.261485 (3 reqs/sec) | DB: 0.009325 (3%)"
|
112
|
+
|
113
|
+
assert_equal 0, @entry.render_time
|
114
|
+
end
|
115
|
+
|
116
|
+
def test_db_time
|
117
|
+
assert_equal 0.002876, @entry.db_time
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
|
122
|
+
class TestLogParser < Test::Unit::TestCase
|
123
|
+
|
124
|
+
def test_class_parse_with_only_completed_at
|
125
|
+
log = StringIO.new <<-EOF
|
126
|
+
Jul 23 12:08:50 trunk rails[27221]: Completed in 0.00507 (197 reqs/sec) | Rendering: 0.00027 (5%) | DB: 0.00055 (10%) | Rows: 88 | Queries: 1 | Guest | Method: GET | Request Size: 0 | Request Type: unknown | Response Format: all | Response Size: 3696 | Processed: RoomsController#list | 200 OK [http://kongregate.com/rooms/list]
|
127
|
+
Jul 23 12:09:18 trunk rails[27221]: Completed in 0.11838 (8 reqs/sec) | Rendering: 0.10371 (87%) | DB: 0.00671 (5%) | Rows: 103 | Queries: 20 | Guest | Method: GET | Request Size: 0 | Request Type: unknown | Response Format: html | Response Size: 27254 | Processed: CategoriesController#show | 200 OK [http://kongregate.com/strategy-defense-games]
|
128
|
+
EOF
|
129
|
+
|
130
|
+
entries = []
|
131
|
+
LogParser.parse log do |entry|
|
132
|
+
entries << entry
|
133
|
+
end
|
134
|
+
|
135
|
+
assert_equal 2, entries.length
|
136
|
+
end
|
137
|
+
|
138
|
+
def test_class_parse
|
139
|
+
log = StringIO.new <<-EOF
|
140
|
+
Mar 7 00:00:25 online1 rails[59628]: Processing RssController#uber (for 67.18.200.5 at Mon Mar 07 00:00:25 CST 2005)
|
141
|
+
Mar 7 00:00:25 online1 rails[59628]: Parameters: {:id=>"author", :"rss/uber/author.html/uber/author"=>nil, :action=>"uber", :username=>"looch", :controller=>"rss"}
|
142
|
+
Mar 7 00:00:25 online1 rails[59628]: Cookie set: auth=dc%2FGUP20BwziF%2BApGecc0pXB0PF0obi55az63ubAFtsnOOdJPkhfJH2U09yuzQD3WtdmWnydLzFcRA78kwi7Gw%3D%3D; path=/; expires=Thu, 05 Mar 2015 06:00:25 GMT
|
143
|
+
Mar 7 00:00:25 online1 rails[59628]: Cookie set: ubid=kF05DqFH%2F9hRCOxTz%2Bfb8Q7UV%2FI%3D; path=/; expires=Thu, 05 Mar 2015 06:00:25 GMT
|
144
|
+
Mar 7 00:00:25 online1 rails[59628]: Browser Load (0.003963) SELECT * FROM browsers WHERE ubid = 'kF05DqFH/9hRCOxTz+fb8Q7UV/I=' LIMIT 1
|
145
|
+
Mar 7 00:00:25 online1 rails[59628]: Person Load (0.002445) SELECT * FROM people WHERE username = 'looch' AND active = '1' LIMIT 1
|
146
|
+
Mar 7 00:00:25 online1 rails[59628]: ProfileImage Load (0.001554) SELECT * FROM profile_images WHERE id = 2782 LIMIT 1
|
147
|
+
Mar 7 00:00:25 online1 rails[59628]: Rendering rss/rss2.0 (200 OK)
|
148
|
+
Mar 7 00:00:25 online1 rails[59628]: Completed in 0.034519 (28 reqs/sec) | Rendering: 0.011770 (34%) | DB: 0.007962 (23%)
|
149
|
+
EOF
|
150
|
+
|
151
|
+
entries = []
|
152
|
+
|
153
|
+
LogParser.parse log do |entry|
|
154
|
+
entries << entry
|
155
|
+
end
|
156
|
+
|
157
|
+
assert_equal 1, entries.length
|
158
|
+
assert_equal 'RssController#uber', entries.first.page
|
159
|
+
end
|
160
|
+
|
161
|
+
def test_class_parse_components
|
162
|
+
log = StringIO.new <<-EOF
|
163
|
+
Jul 11 10:05:20 www rails[61243]: Processing ChatroomsController#launch (for 213.152.37.169 at Mon Jul 11 10:05:20 CDT 2005)
|
164
|
+
Jul 11 10:05:20 www rails[61243]: Start rendering component ({:action=>"online_count", :controller=>"members"}):
|
165
|
+
Jul 11 10:05:20 www rails[34216]: Processing ChatroomsController#launch (for 213.152.37.169 at Mon Jul 11 10:05:20 CDT 2005)
|
166
|
+
Jul 11 10:05:20 www rails[34216]: Start rendering component ({:action=>"online_count", :controller=>"members"}):
|
167
|
+
Jul 11 10:05:20 www rails[34216]: Processing MembersController#online_count (for 213.152.37.169 at Mon Jul 11 10:05:20 CDT 2005)
|
168
|
+
Jul 11 10:05:20 www rails[34216]: Completed in 0.00741 (135 reqs/sec) | DB: 0.00320 (43%)
|
169
|
+
Jul 11 10:05:20 www rails[34216]: End of component rendering
|
170
|
+
Jul 11 10:05:28 www rails[34216]: Completed in 8.65005 (0 reqs/sec) | Rendering: 8.64820 (99%) | DB: 0.00000 (0%)
|
171
|
+
Jul 11 10:05:20 www rails[34216]: Processing ChatroomsController#launch (for 213.152.37.169 at Mon Jul 11 10:05:20 CDT 2005)
|
172
|
+
Jul 11 10:05:20 www rails[34216]: Start rendering component ({:action=>"online_count", :controller=>"members"}):
|
173
|
+
Jul 11 10:05:20 www rails[34216]: Processing MembersController#online_count (for 213.152.37.169 at Mon Jul 11 10:05:20 CDT 2005)
|
174
|
+
Jul 11 10:05:20 www rails[34216]: Completed in 0.00741 (135 reqs/sec) | DB: 0.00320 (43%)
|
175
|
+
Jul 11 10:05:20 www rails[34216]: End of component rendering
|
176
|
+
Jul 11 10:05:28 www rails[34216]: Completed in 8.65005 (0 reqs/sec) | Rendering: 8.64820 (99%) | DB: 0.00000 (0%)
|
177
|
+
Jul 11 10:05:20 www rails[61243]: Processing MembersController#online_count (for 213.152.37.169 at Mon Jul 11 10:05:20 CDT 2005)
|
178
|
+
Jul 11 10:05:20 www rails[61243]: Completed in 0.00741 (135 reqs/sec) | DB: 0.00320 (43%)
|
179
|
+
Jul 11 10:05:20 www rails[61243]: End of component rendering
|
180
|
+
Jul 11 10:05:28 www rails[61243]: Completed in 8.65005 (0 reqs/sec) | Rendering: 8.64820 (99%) | DB: 0.00000 (0%)
|
181
|
+
EOF
|
182
|
+
|
183
|
+
entries = []
|
184
|
+
LogParser.parse(log) { |entry| entries << entry }
|
185
|
+
|
186
|
+
assert_equal 3, entries.length
|
187
|
+
assert_equal 'ChatroomsController#launch', entries.first.page
|
188
|
+
assert_equal 8.65005, entries.first.request_time
|
189
|
+
end
|
190
|
+
|
191
|
+
def test_class_parse_entries_with_pre_processing_garbage
|
192
|
+
log = StringIO.new <<-EOF
|
193
|
+
Jan 03 12:51:34 duo2 rails[4347]: [4;36;1mFont Load (0.000475)[0m [0;1mSELECT * FROM fonts ORDER BY name [0m
|
194
|
+
Jan 03 12:51:34 duo2 rails[4347]: Processing StylesheetsController#show (for 127.0.0.1 at 2007-01-03 12:51:34) [GET]
|
195
|
+
Jan 03 12:51:34 duo2 rails[4347]: Parameters: {"action"=>"show", "id"=>"1", "controller"=>"stylesheets"}
|
196
|
+
Jan 03 12:51:34 duo2 rails[4347]: [4;35;1mNewspaper Load (0.000970)[0m [0mSELECT newspapers.* FROM newspapers INNER JOIN users ON newspapers.editor_in_chief = users.id WHERE (users.login = 'geoff') LIMIT 1[0m
|
197
|
+
Jan 03 12:51:34 duo2 rails[4347]: [4;36;1mLayout Load (0.000501)[0m [0;1mSELECT * FROM layouts WHERE (layouts.id = 1) LIMIT 1[0m
|
198
|
+
Jan 03 12:51:34 duo2 rails[4347]: Completed in 0.00807 (123 reqs/sec) | Rendering: 0.00006 (0%) | DB: 0.00195 (24%) | 200 OK [http://geoff.localhost.com/stylesheets/show/1/styles.css]
|
199
|
+
EOF
|
200
|
+
|
201
|
+
entries = []
|
202
|
+
LogParser.parse(log) { |entry| entries << entry }
|
203
|
+
|
204
|
+
assert_equal 1, entries.length, "Number of entries was incorrect"
|
205
|
+
assert_equal 'StylesheetsController#show', entries.first.page
|
206
|
+
assert_equal 0.00807, entries.first.request_time
|
207
|
+
end
|
208
|
+
|
209
|
+
def test_class_parse_rails_engines_plugin
|
210
|
+
log = StringIO.new <<-EOF
|
211
|
+
Jan 03 12:24:21 duo2 rails[4277]: Trying to start engine 'login_engine' from '/Users/topfunky/web/rails/repos/roughunderbelly/vendor/plugins/login_engine'
|
212
|
+
Jan 03 12:24:21 duo2 rails[4277]: adding /Users/topfunky/web/rails/repos/roughunderbelly/vendor/plugins/login_engine/lib/login_engine to the load path
|
213
|
+
Jan 03 12:24:21 duo2 rails[4277]: adding /Users/topfunky/web/rails/repos/roughunderbelly/vendor/plugins/login_engine/app/views/user_notify to the load path
|
214
|
+
Jan 03 12:24:21 duo2 rails[4277]: adding /Users/topfunky/web/rails/repos/roughunderbelly/vendor/plugins/login_engine/app/views/user to the load path
|
215
|
+
Jan 03 12:24:21 duo2 rails[4277]: adding /Users/topfunky/web/rails/repos/roughunderbelly/vendor/plugins/login_engine/app/views to the load path
|
216
|
+
Jan 03 12:24:21 duo2 rails[4277]: adding /Users/topfunky/web/rails/repos/roughunderbelly/vendor/plugins/login_engine/app/models to the load path
|
217
|
+
Jan 03 12:24:21 duo2 rails[4277]: adding /Users/topfunky/web/rails/repos/roughunderbelly/vendor/plugins/login_engine/app/helpers to the load path
|
218
|
+
Jan 03 12:24:21 duo2 rails[4277]: adding /Users/topfunky/web/rails/repos/roughunderbelly/vendor/plugins/login_engine/app/controllers to the load path
|
219
|
+
Jan 03 12:24:21 duo2 rails[4277]: Attempting to copy public engine files from '/Users/topfunky/web/rails/repos/roughunderbelly/config/../vendor/plugins/login_engine/public'
|
220
|
+
Jan 03 12:24:21 duo2 rails[4277]: source dirs: ["/Users/topfunky/web/rails/repos/roughunderbelly/config/../vendor/plugins/login_engine/public/stylesheets"]
|
221
|
+
Jan 03 12:24:22 duo2 rails[4277]: finally loading from application: 'exception_notifier.rb'
|
222
|
+
Jan 03 12:24:22 duo2 rails[4277]: requiring file 'exception_notifier_helper'
|
223
|
+
Jan 03 12:24:22 duo2 rails[4277]: checking 'login_engine' for /Users/topfunky/web/rails/repos/roughunderbelly/config/../vendor/plugins/login_engine/exception_notifier_helper.rb
|
224
|
+
Jan 03 12:24:22 duo2 rails[4277]: finally loading from application: 'exception_notifier_helper.rb'
|
225
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: '/Users/topfunky/web/rails/repos/roughunderbelly/config/../app/controllers/application.rb'
|
226
|
+
Jan 03 12:24:23 duo2 rails[4277]: requiring file 'application_helper'
|
227
|
+
Jan 03 12:24:23 duo2 rails[4277]: checking 'login_engine' for /Users/topfunky/web/rails/repos/roughunderbelly/config/../vendor/plugins/login_engine/application_helper.rb
|
228
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'application_helper.rb'
|
229
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'exception_notifiable.rb'
|
230
|
+
Jan 03 12:24:23 duo2 rails[4277]: requiring file 'user_helper'
|
231
|
+
Jan 03 12:24:23 duo2 rails[4277]: checking 'login_engine' for /Users/topfunky/web/rails/repos/roughunderbelly/config/../vendor/plugins/login_engine/user_helper.rb
|
232
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'user_helper.rb'
|
233
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'user.rb'
|
234
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'task.rb'
|
235
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'client.rb'
|
236
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'email.rb'
|
237
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'worth.rb'
|
238
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'column_pref.rb'
|
239
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'timer.rb'
|
240
|
+
Jan 03 12:24:23 duo2 rails[4277]: requiring file '/Users/topfunky/web/rails/repos/roughunderbelly/config/../app/controllers/tasks_controller.rb'
|
241
|
+
Jan 03 12:24:23 duo2 rails[4277]: detected RAILS_ROOT, rewriting to 'app/controllers/tasks_controller.rb'
|
242
|
+
Jan 03 12:24:23 duo2 rails[4277]: checking 'login_engine' for /Users/topfunky/web/rails/repos/roughunderbelly/config/../vendor/plugins/login_engine/app/controllers/tasks_controller.rb
|
243
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: '/Users/topfunky/web/rails/repos/roughunderbelly/config/../app/controllers/tasks_controller.rb'
|
244
|
+
Jan 03 12:24:23 duo2 rails[4277]: requiring file 'tasks_helper'
|
245
|
+
Jan 03 12:24:23 duo2 rails[4277]: checking 'login_engine' for /Users/topfunky/web/rails/repos/roughunderbelly/config/../vendor/plugins/login_engine/tasks_helper.rb
|
246
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'tasks_helper.rb'
|
247
|
+
Jan 03 12:24:23 duo2 rails[4277]: requiring file 'sparklines_helper'
|
248
|
+
Jan 03 12:24:23 duo2 rails[4277]: checking 'login_engine' for /Users/topfunky/web/rails/repos/roughunderbelly/config/../vendor/plugins/login_engine/sparklines_helper.rb
|
249
|
+
Jan 03 12:24:23 duo2 rails[4277]: finally loading from application: 'sparklines_helper.rb'
|
250
|
+
Jan 03 12:24:24 duo2 rails[4277]: [4;36;1mSQL (0.000072)[0m [0;1mBEGIN[0m
|
251
|
+
Jan 03 12:24:24 duo2 rails[4277]: [4;35;1mSQL (0.000240)[0m [0mINSERT INTO sessions (`updated_at`, `session_id`, `data`) VALUES('2007-01-03 20:24:24', 'bdbb75323d5da69f707d5576e907706e', 'BAh7AA==\n')[0m
|
252
|
+
Jan 03 12:24:24 duo2 rails[4277]: [4;36;1mSQL (0.000400)[0m [0;1mCOMMIT[0m
|
253
|
+
Jan 03 12:24:24 duo2 rails[4277]: Processing TasksController#index (for 127.0.0.1 at 2007-01-03 12:24:24) [GET]
|
254
|
+
Jan 03 12:24:24 duo2 rails[4277]: Parameters: {"action"=>"index", "controller"=>"tasks"}
|
255
|
+
Jan 03 12:24:24 duo2 rails[4277]: Redirected to http://localhost:3000/tasks/list
|
256
|
+
Jan 03 12:24:24 duo2 rails[4277]: Completed in 0.00112 (896 reqs/sec) | DB: 0.00071 (63%) | 302 Found [http://localhost/]
|
257
|
+
EOF
|
258
|
+
|
259
|
+
entries = []
|
260
|
+
LogParser.parse(log) { |entry| entries << entry }
|
261
|
+
|
262
|
+
assert_equal 1, entries.length, "The number of entries was incorrect"
|
263
|
+
assert_equal 'TasksController#index', entries.first.page
|
264
|
+
assert_equal 0.00112, entries.first.request_time
|
265
|
+
end
|
266
|
+
|
267
|
+
def test_class_parse_multi
|
268
|
+
entries = []
|
269
|
+
File.open "#{File.dirname(__FILE__)}/test.syslog.log" do |fp|
|
270
|
+
LogParser.parse fp do |entry|
|
271
|
+
entries << entry
|
272
|
+
end
|
273
|
+
end
|
274
|
+
|
275
|
+
assert_equal 13, entries.length
|
276
|
+
assert_equal 0.300741, entries.first.request_time
|
277
|
+
|
278
|
+
redirect = entries[6]
|
279
|
+
assert_equal 'TeamsController#progress', redirect.page
|
280
|
+
assert_equal 0, redirect.render_time
|
281
|
+
|
282
|
+
last = entries.last
|
283
|
+
assert_equal 'PeopleController#progress', last.page
|
284
|
+
assert_equal 0, last.request_time
|
285
|
+
end
|
286
|
+
|
287
|
+
def test_class_parse_0_14_x
|
288
|
+
entries = []
|
289
|
+
File.open "#{File.dirname(__FILE__)}/test.syslog.0.14.x.log" do |fp|
|
290
|
+
LogParser.parse fp do |entry|
|
291
|
+
entries << entry
|
292
|
+
end
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
end
|
297
|
+
|
metadata
ADDED
@@ -0,0 +1,97 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: erkki-production_log_analyzer
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: "2009022401"
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Eric Hodel
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
|
12
|
+
date: 2009-02-24 00:00:00 -08:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: rails_analyzer_tools
|
17
|
+
type: :runtime
|
18
|
+
version_requirement:
|
19
|
+
version_requirements: !ruby/object:Gem::Requirement
|
20
|
+
requirements:
|
21
|
+
- - ">="
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 1.4.0
|
24
|
+
version:
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: hoe
|
27
|
+
type: :runtime
|
28
|
+
version_requirement:
|
29
|
+
version_requirements: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.8.3
|
34
|
+
version:
|
35
|
+
description: production_log_analyzer provides three tools to analyze log files created by SyslogLogger. pl_analyze for getting daily reports, action_grep for pulling log lines for a single action and action_errors to summarize errors with counts.
|
36
|
+
email: drbrain@segment7.net
|
37
|
+
executables:
|
38
|
+
- action_errors
|
39
|
+
- action_grep
|
40
|
+
- pl_analyze
|
41
|
+
extensions: []
|
42
|
+
|
43
|
+
extra_rdoc_files:
|
44
|
+
- History.txt
|
45
|
+
- LICENSE.txt
|
46
|
+
- Manifest.txt
|
47
|
+
- README.txt
|
48
|
+
files:
|
49
|
+
- History.txt
|
50
|
+
- LICENSE.txt
|
51
|
+
- Manifest.txt
|
52
|
+
- README.txt
|
53
|
+
- Rakefile
|
54
|
+
- bin/action_errors
|
55
|
+
- bin/action_grep
|
56
|
+
- bin/pl_analyze
|
57
|
+
- lib/production_log/action_grep.rb
|
58
|
+
- lib/production_log/analyzer.rb
|
59
|
+
- lib/production_log/parser.rb
|
60
|
+
- test/test.syslog.0.14.x.log
|
61
|
+
- test/test.syslog.1.2.shortname.log
|
62
|
+
- test/test.syslog.empty.log
|
63
|
+
- test/test.syslog.log
|
64
|
+
- test/test_action_grep.rb
|
65
|
+
- test/test_analyzer.rb
|
66
|
+
- test/test_parser.rb
|
67
|
+
has_rdoc: true
|
68
|
+
homepage: http://seattlerb.rubyforge.org/production_log_analyzer
|
69
|
+
post_install_message:
|
70
|
+
rdoc_options:
|
71
|
+
- --main
|
72
|
+
- README.txt
|
73
|
+
require_paths:
|
74
|
+
- lib
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
76
|
+
requirements:
|
77
|
+
- - ">="
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: "0"
|
80
|
+
version:
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: "0"
|
86
|
+
version:
|
87
|
+
requirements: []
|
88
|
+
|
89
|
+
rubyforge_project: seattlerb
|
90
|
+
rubygems_version: 1.2.0
|
91
|
+
signing_key:
|
92
|
+
specification_version: 2
|
93
|
+
summary: production_log_analyzer lets you find out which actions on a Rails site are slowing you down.
|
94
|
+
test_files:
|
95
|
+
- test/test_action_grep.rb
|
96
|
+
- test/test_analyzer.rb
|
97
|
+
- test/test_parser.rb
|