log_sense 1.4.0 → 1.4.1
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.
- checksums.yaml +4 -4
- data/CHANGELOG.org +12 -0
- data/README.org +5 -4
- data/exe/log_sense +13 -15
- data/lib/log_sense/apache_data_cruncher.rb +3 -3
- data/lib/log_sense/apache_log_line_parser.rb +9 -9
- data/lib/log_sense/apache_log_parser.rb +44 -36
- data/lib/log_sense/emitter.rb +454 -21
- data/lib/log_sense/options_parser.rb +29 -29
- data/lib/log_sense/rails_data_cruncher.rb +4 -3
- data/lib/log_sense/rails_log_parser.rb +108 -100
- data/lib/log_sense/templates/_command_invocation.html.erb +0 -4
- data/lib/log_sense/templates/_command_invocation.txt.erb +4 -3
- data/lib/log_sense/templates/_output_table.html.erb +1 -7
- data/lib/log_sense/templates/_output_table.txt.erb +13 -0
- data/lib/log_sense/templates/_performance.html.erb +1 -1
- data/lib/log_sense/templates/_performance.txt.erb +8 -5
- data/lib/log_sense/templates/_report_data.html.erb +2 -3
- data/lib/log_sense/templates/_summary.html.erb +1 -1
- data/lib/log_sense/templates/_summary.txt.erb +11 -8
- data/lib/log_sense/templates/apache.html.erb +1 -212
- data/lib/log_sense/templates/apache.txt.erb +35 -0
- data/lib/log_sense/templates/rails.html.erb +0 -137
- data/lib/log_sense/templates/rails.txt.erb +8 -57
- data/lib/log_sense/version.rb +1 -1
- metadata +4 -2
@@ -0,0 +1,35 @@
|
|
1
|
+
* Apache Log Analysis
|
2
|
+
|
3
|
+
>>>> URLs NOT SANITIZED. DO NOT CONVERT TO HTML <<<<
|
4
|
+
>>>> (USE THE HTML EXPORT FUNCTION INSTEAD) <<<<
|
5
|
+
|
6
|
+
** Summary
|
7
|
+
|
8
|
+
<%= render "summary.txt.erb", data: data %>
|
9
|
+
|
10
|
+
<% @reports.each do |report| %>
|
11
|
+
** <%= report[:title] %>
|
12
|
+
|
13
|
+
<%= render "output_table.txt.erb", report: report, data: data %>
|
14
|
+
<% end %>
|
15
|
+
|
16
|
+
** Geolocation
|
17
|
+
|
18
|
+
<%=
|
19
|
+
ips = data[:ips].group_by { |x| x[4] }.map { |k, v|
|
20
|
+
[k, v.map { |x| x[1] }.inject(&:+), v.map { |x| x[2] }.inject(&:+) ]
|
21
|
+
}
|
22
|
+
table = Terminal::Table.new headings: ["Country", "Hits", "Total Visits"], rows: ips
|
23
|
+
table.style = { border_i: "|" }
|
24
|
+
(1..2).map { |i| table.align_column(i, :right) }
|
25
|
+
table
|
26
|
+
%>
|
27
|
+
|
28
|
+
** Command Invocation
|
29
|
+
|
30
|
+
<%= render 'command_invocation.txt.erb', data: data %>
|
31
|
+
|
32
|
+
** Performance
|
33
|
+
|
34
|
+
<%= render 'performance.txt.erb', data: data %>
|
35
|
+
|
@@ -215,143 +215,6 @@
|
|
215
215
|
</article>
|
216
216
|
</div>
|
217
217
|
|
218
|
-
<% @reports = [
|
219
|
-
{ title: "Daily Distribution",
|
220
|
-
header: ["Day", "DOW", "Hits"],
|
221
|
-
rows: data[:daily_distribution],
|
222
|
-
vega_spec: {
|
223
|
-
"encoding": {
|
224
|
-
"x": {"field": "Day", "type": "temporal"},
|
225
|
-
"y": {"field": "Hits", "type": "quantitative"}
|
226
|
-
},
|
227
|
-
"layer": [
|
228
|
-
{
|
229
|
-
"mark": {
|
230
|
-
"type": "line",
|
231
|
-
"point": {
|
232
|
-
"filled": false,
|
233
|
-
"fill": "white"
|
234
|
-
}
|
235
|
-
}
|
236
|
-
},
|
237
|
-
{
|
238
|
-
"mark": {
|
239
|
-
"type": "text",
|
240
|
-
"align": "left",
|
241
|
-
"baseline": "middle",
|
242
|
-
"dx": 5
|
243
|
-
},
|
244
|
-
"encoding": {
|
245
|
-
"text": {"field": "Hits", "type": "quantitative"}
|
246
|
-
}
|
247
|
-
}
|
248
|
-
]
|
249
|
-
}
|
250
|
-
},
|
251
|
-
{ title: "Time Distribution",
|
252
|
-
header: ["Hour", "Hits"],
|
253
|
-
rows: data[:time_distribution],
|
254
|
-
vega_spec: {
|
255
|
-
"layer": [
|
256
|
-
{
|
257
|
-
"mark": "bar",
|
258
|
-
},
|
259
|
-
{
|
260
|
-
"mark": {
|
261
|
-
"type": "text",
|
262
|
-
"align": "middle",
|
263
|
-
"baseline": "top",
|
264
|
-
"dx": -10,
|
265
|
-
"yOffset": -15
|
266
|
-
},
|
267
|
-
"encoding": {
|
268
|
-
"text": {"field": "Hits", "type": "quantitative"}
|
269
|
-
}
|
270
|
-
}
|
271
|
-
],
|
272
|
-
"encoding": {
|
273
|
-
"x": {"field": "Hour", "type": "nominal"},
|
274
|
-
"y": {"field": "Hits", "type": "quantitative"}
|
275
|
-
}
|
276
|
-
}
|
277
|
-
},
|
278
|
-
{ title: "Statuses",
|
279
|
-
header: ["Status", "Count"],
|
280
|
-
rows: data[:statuses],
|
281
|
-
vega_spec: {
|
282
|
-
"layer": [
|
283
|
-
{
|
284
|
-
"mark": "bar"
|
285
|
-
},
|
286
|
-
{
|
287
|
-
"mark": {
|
288
|
-
"type": "text",
|
289
|
-
"align": "left",
|
290
|
-
"baseline": "top",
|
291
|
-
"dx": -10,
|
292
|
-
"yOffset": -20
|
293
|
-
},
|
294
|
-
"encoding": {
|
295
|
-
"text": {"field": "Count", "type": "quantitative"}
|
296
|
-
}
|
297
|
-
}
|
298
|
-
],
|
299
|
-
"encoding": {
|
300
|
-
"x": {"field": "Status", "type": "nominal"},
|
301
|
-
"y": {"field": "Count", "type": "quantitative"}
|
302
|
-
}
|
303
|
-
}
|
304
|
-
},
|
305
|
-
{ title: "Rails Performance",
|
306
|
-
header: ['Controller', 'Hits', 'Min', 'Avg', 'Max'],
|
307
|
-
rows: @data[:performance],
|
308
|
-
vega_spec: {
|
309
|
-
"layer": [
|
310
|
-
{
|
311
|
-
"mark": {
|
312
|
-
"type": "point",
|
313
|
-
"name": "data_points"
|
314
|
-
}
|
315
|
-
},
|
316
|
-
{
|
317
|
-
"mark": {
|
318
|
-
"name": "label",
|
319
|
-
"type": "text",
|
320
|
-
"align": "left",
|
321
|
-
"baseline": "middle",
|
322
|
-
"dx": 5,
|
323
|
-
"yOffset": 0
|
324
|
-
},
|
325
|
-
"encoding": {
|
326
|
-
"text": {"field": "Controller"},
|
327
|
-
"fontSize": {"value": 8}
|
328
|
-
},
|
329
|
-
},
|
330
|
-
],
|
331
|
-
"encoding": {
|
332
|
-
"x": {"field": "Avg", "type": "quantitative"},
|
333
|
-
"y": {"field": "Hits", "type": "quantitative"}
|
334
|
-
},
|
335
|
-
}
|
336
|
-
},
|
337
|
-
{ title: "Fatal Events",
|
338
|
-
header: ['Date', 'IP', 'URL', 'Description', 'Log ID'], rows: @data[:fatal],
|
339
|
-
col: "small-12 cell"
|
340
|
-
},
|
341
|
-
{ title: "Internal Server Errors",
|
342
|
-
header: ['Date', 'Status', 'IP', 'URL', 'Description', 'Log ID'], rows: @data[:internal_server_error],
|
343
|
-
col: "small-12 cell"
|
344
|
-
},
|
345
|
-
{ title: "Errors",
|
346
|
-
header: ['Log ID', 'Context', 'Description', 'Count'], rows: @data[:error],
|
347
|
-
col: "small-12 cell"
|
348
|
-
},
|
349
|
-
{ title: "IPs",
|
350
|
-
header: ["IPs", "Hits", "Country"],
|
351
|
-
rows: data[:ips]
|
352
|
-
},
|
353
|
-
]
|
354
|
-
%>
|
355
218
|
<div class="grid-x grid-margin-x">
|
356
219
|
<% @reports.each_with_index do |report, index| %>
|
357
220
|
<article class="card cell <%= report[:col] || "small-12 large-6" %>" >
|
@@ -1,66 +1,17 @@
|
|
1
1
|
* Rails Log Analysis
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
** Access by Day
|
6
|
-
|
7
|
-
<%=
|
8
|
-
table = Terminal::Table.new headings: ['Date', 'Day', 'Events'], rows: @data[:daily_distribution]
|
9
|
-
table.align_column(3, :right)
|
10
|
-
table
|
11
|
-
%>
|
12
|
-
|
13
|
-
** Access by Time
|
14
|
-
|
15
|
-
<%=
|
16
|
-
table = Terminal::Table.new headings: ['Hour', 'Events'], rows: @data[:time_distribution]
|
17
|
-
table.align_column(2, :right)
|
18
|
-
table
|
19
|
-
%>
|
20
|
-
|
21
|
-
** Statuses
|
22
|
-
|
23
|
-
<%=
|
24
|
-
table = Terminal::Table.new headings: ['Status', 'Events'], rows: @data[:statuses]
|
25
|
-
table.align_column(2, :right)
|
26
|
-
table
|
27
|
-
%>
|
3
|
+
>>>> URLs NOT SANITIZED. DO NOT CONVERT TO HTML <<<<
|
4
|
+
>>>> (USE THE HTML EXPORT FUNCTION INSTEAD) <<<<
|
28
5
|
|
29
|
-
**
|
6
|
+
** Summary
|
30
7
|
|
31
|
-
<%=
|
32
|
-
table.align_column(1, :right)
|
33
|
-
table.align_column(2, :right)
|
34
|
-
table.align_column(3, :right)
|
35
|
-
table.align_column(4, :right)
|
36
|
-
table
|
37
|
-
%>
|
38
|
-
|
39
|
-
** Fatal Events
|
40
|
-
|
41
|
-
<%= table = Terminal::Table.new headings: ['Date', 'IP', 'URL', 'Description', 'Log ID'], rows: @data[:fatal]
|
42
|
-
table
|
43
|
-
%>
|
44
|
-
|
45
|
-
** Internal Server Errors
|
46
|
-
|
47
|
-
<%= table = Terminal::Table.new headings: ['Date', 'Status', 'IP', 'URL', 'Description', 'Log ID'], rows: @data[:internal_server_error]
|
48
|
-
table
|
49
|
-
%>
|
50
|
-
|
51
|
-
** Errors
|
52
|
-
|
53
|
-
<%= table = Terminal::Table.new headings: ['Log ID', 'Context', 'Description', 'Count'], rows: @data[:error]
|
54
|
-
table
|
55
|
-
%>
|
8
|
+
<%= render "summary.txt.erb", data: data %>
|
56
9
|
|
57
|
-
|
10
|
+
<% @reports.each do |report| %>
|
11
|
+
** <%= report[:title] %>
|
58
12
|
|
59
|
-
<%=
|
60
|
-
|
61
|
-
table.align_column(1, :right)
|
62
|
-
table
|
63
|
-
%>
|
13
|
+
<%= render "output_table.txt.erb", report: report, data: data %>
|
14
|
+
<% end %>
|
64
15
|
|
65
16
|
** Command Invocation
|
66
17
|
|
data/lib/log_sense/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: log_sense
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Adolfo Fibrillation
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-03-
|
11
|
+
date: 2022-03-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: browser
|
@@ -142,12 +142,14 @@ files:
|
|
142
142
|
- lib/log_sense/templates/_command_invocation.txt.erb
|
143
143
|
- lib/log_sense/templates/_log_structure.html.erb
|
144
144
|
- lib/log_sense/templates/_output_table.html.erb
|
145
|
+
- lib/log_sense/templates/_output_table.txt.erb
|
145
146
|
- lib/log_sense/templates/_performance.html.erb
|
146
147
|
- lib/log_sense/templates/_performance.txt.erb
|
147
148
|
- lib/log_sense/templates/_report_data.html.erb
|
148
149
|
- lib/log_sense/templates/_summary.html.erb
|
149
150
|
- lib/log_sense/templates/_summary.txt.erb
|
150
151
|
- lib/log_sense/templates/apache.html.erb
|
152
|
+
- lib/log_sense/templates/apache.txt.erb
|
151
153
|
- lib/log_sense/templates/rails.html.erb
|
152
154
|
- lib/log_sense/templates/rails.txt.erb
|
153
155
|
- lib/log_sense/version.rb
|