log_sense 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e05abbc9fc93aa9ccd057f3a01f6c93d966e964695d486e3425b3b4bc073c52
4
- data.tar.gz: 7514a501cf9ac3766b457bca1d31a545a1331e35d5e8591aa81965994943580d
3
+ metadata.gz: 6498507bb6ae7e6ba5505609421154358790f095bd9cfe5ab912920b2409f7d1
4
+ data.tar.gz: 0ccb5fa005b8f1e47545bf98ce05273f07bd452d3be54c5bd1a7f124c96558d9
5
5
  SHA512:
6
- metadata.gz: 91cbf90786d0c6479b246b9df92f67fcae73491d3d622eb99c364a8d279aa1ca8aac009ba765c1b75734ca9d664d334bd4aed970c02b6e8fda8a3a15f8534c52
7
- data.tar.gz: 9b41aa16dd595fe664f6a1ba90bbb196dcbc945c760f6ea6ddcb30569ff0767f70f06487790c3eda0f0d8cd35c30cba4bab2982a3825067025e30a5a5dcb56f3
6
+ metadata.gz: e12760ccdfc518c7221afa337f4ac1c8a77219cd3ed65510486e3ce945e6129519aa3fe93b05845a5430b9bc52359d70591e0fcbd346e971527af1760c304e5c
7
+ data.tar.gz: 8d38d8ed84287722b77f51599598b84a2257f9f86d2dd3815faf25dfb7db4ab16e68dbf737c7d005519ac5f9fe1d4b41cd896dfaf862eabb6a7dc4f033d2bb13
data/CHANGELOG.org CHANGED
@@ -2,13 +2,20 @@
2
2
  #+AUTHOR: Adolfo Villafiorita
3
3
  #+STARTUP: showall
4
4
 
5
- * Changes in log_sense 1.1.2
6
- <2021-12-17 Fri>
5
+ * 1.3.2
7
6
 
8
- - Added Rails Log HTML output
7
+ - [Code] HTML reports now generate JSON data which is shared between
8
+ DataTable and Vega Light: this should reduce page size and loading
9
+ time of HTML reports
10
+ - [Doc] Added screenshot and fixed some text
11
+ - [Doc] Fixes requirements on Ruby version
9
12
 
10
- * Changes in log_sense 1.1.1 and earlier
11
- <2021-12-17 Fri>
13
+ * 1.3.1
12
14
 
13
- - In the Git commit messages (not very informative, I am afraid).
15
+ - [Code] Strengthened parsing of Apache Logs (added WebDav and other methods)
14
16
 
17
+ * 1.3.0
18
+
19
+ - [Code] Removed dependency from =apache_log-parser= and implemented our own
20
+ parser for the combined format.
21
+
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- log_sense (1.0.7)
5
- apache_log-parser
4
+ log_sense (1.3.1)
6
5
  browser
7
6
  ipaddr
8
7
  iso_country_codes
@@ -12,7 +11,6 @@ PATH
12
11
  GEM
13
12
  remote: https://rubygems.org/
14
13
  specs:
15
- apache_log-parser (3.1.2)
16
14
  browser (5.3.1)
17
15
  byebug (11.1.3)
18
16
  ipaddr (1.2.3)
data/README.org CHANGED
@@ -4,24 +4,10 @@
4
4
 
5
5
  * Introduction
6
6
 
7
- LogSense generates reports and statistics from Apache web logs in the
8
- =combined= format and from Rails logs. Written in Ruby, it runs from
9
- the command line, it is fast, and it can be installed on any system
10
- which supports Ruby.
11
-
12
- LogSense moves along the lines of tools such as [[https://goaccess.io/][GoAccess]]
13
- and [[https://umami.is/][Umami]], focusing on privacy and data-ownership: the data
14
- generated by LogSense is stored on your computer and owned by
15
- you (like it should be).
16
-
17
- LogSense is also inspired by *static websites generators*: statistics
18
- are generated from the command line and accessed as static HTML files.
19
- By generating static resources, LogSense significantly reduces the
20
- attack surface of your webserver and installation headaches.
21
-
22
- We have, for instance, a cron job running on our servers, generating
23
- statistics at night. The generated files are then made available on a
24
- private area on the web.
7
+ LogSense generates reports and statistics from Apache and Ruby on
8
+ Rails logs. Written in Ruby, it runs from the command line, it is
9
+ fast, and it can be installed on any system with a relatively recent
10
+ version of Ruby. We tested on Ruby 2.6.9, Ruby 3.0.x and later.
25
11
 
26
12
  LogSense reports the following data:
27
13
 
@@ -40,7 +26,27 @@ LogSense reports the following data:
40
26
  Filters from the command line allow to analyze specific periods and
41
27
  distinguish traffic generated by self polls and crawlers.
42
28
 
43
- LogSense generates HTML, txt (Org Mode), and SQLite outputs.
29
+ LogSense generates HTML, txt, and SQLite outputs.
30
+
31
+ And, of course, the compulsory screenshot:
32
+
33
+ #+ATTR_HTML: :width 80%
34
+ [[file:./apache-screenshot.png]]
35
+
36
+ * Motivation
37
+
38
+ LogSense moves along the lines of tools such as [[https://goaccess.io/][GoAccess]] (which
39
+ strongly inspired the development of Log Sense) and [[https://umami.is/][Umami]], focusing on
40
+ *privacy* and *data-ownership*: the data generated by LogSense is
41
+ stored on your computer and owned by you (like it should be)[fn:1].
42
+
43
+ LogSense is also inspired by *static websites generators*: statistics
44
+ are generated from the command line and accessed as static HTML files.
45
+ LogSense thus significantly reduces the attack surface of your
46
+ webserver and installation headaches. We have, for instance, a Cron
47
+ job running on our servers, generating statistics at night. The
48
+ generated files are then made available on a private area on the web.
49
+
44
50
 
45
51
  * Installation
46
52
 
@@ -81,37 +87,48 @@ LogSense generates HTML, txt (Org Mode), and SQLite outputs.
81
87
  - txt
82
88
  #+end_example
83
89
 
90
+ Examples:
91
+
92
+ #+begin_example sh
93
+ log_sense -f apache -i access.log -t txt > access-data.txt
94
+ log_sense -f rails -i production.log -t html > performance.txt
95
+ #+end_example
96
+
84
97
  * Change Log
85
98
 
86
99
  See the [[file:CHANGELOG.org][CHANGELOG]] file.
87
100
 
88
101
  * Compatibility
89
102
 
90
- LogSense should run on any system on which Ruby runs.
103
+ LogSense should run on any system on which a recent version of Ruby
104
+ runs. We tested it with Ruby 2.6.9 and Ruby 3.x.x.
91
105
 
92
106
  Concerning the outputs:
93
107
 
94
- - The HTML report uses [[https://picturepan2.github.io/spectre/][Spectre.css]] and (will use) [[https://vega.github.io/vega-lite/][Vega Light]], which
95
- are downloaded from a CDN
96
- - The textual format is compatible with Org Mode and can be further
97
- processed to any format Org Mode can be exported to (including HTML
98
- and PDF),
108
+ - HTML reports use [[https://get.foundation/][Zurb Foundation]], [[https://www.datatables.net/][Data Tables]], and [[https://vega.github.io/vega-lite/][Vega Light]], which
109
+ are all downloaded from a CDN
110
+ - The textual format is compatible with [[https://orgmode.org/][Org Mode]] and can be further
111
+ processed to any format [[https://orgmode.org/][Org Mode]] can be exported to (including HTML
112
+ and PDF)
99
113
 
100
114
  * Author and Contributors
101
115
 
102
- [[http://ict4g.net/adolfo][Adolfo Villafiorita]].
116
+ [[https://shair.tech][Shair.Tech]]
103
117
 
104
118
  * Known Bugs
105
119
 
106
- Some known bugs and an unknown number of unknown bugs.
107
-
120
+ No known bugs; an unknown number of unknown bugs.
108
121
  (See the open issues for the known bugs.)
109
122
 
110
123
  * License
111
124
 
112
125
  Distributed under the terms of the [[http://opensource.org/licenses/MIT][MIT License]].
113
126
 
114
- Geolocation is made possible by the DB-IP.com IP to City database, released under
115
- a CC license.
116
-
127
+ Geolocation is made possible by the DB-IP.com IP to City database,
128
+ released under a CC license.
117
129
 
130
+ [fn:1] There is a small catch: CSS and JavaScript for layout and plots
131
+ are downloaded from a CDN. Technically, thus, if you generate HTML
132
+ reports and open them, a request is performed and the CDN might keep a
133
+ track (see [[https://en.wikipedia.org/wiki/Content_delivery_network#Security_and_privacy][CDN Security and Privacy on Wikipedia]] for more details).
134
+ Textual reports don't have this issue.
Binary file
@@ -4,22 +4,26 @@ def slugify string
4
4
  end
5
5
  %>
6
6
 
7
- <table id="<%= slugify(title || "") %>-table" class="table unstriped data-table <%= slugify(title || "") %>">
7
+ <table id="table-<%= index %>" class="table unstriped">
8
8
  <thead>
9
9
  <tr>
10
- <% header.each do |heading| %>
11
- <th class="<%= slugify(heading) %>"><%= heading %></th>
10
+ <% report[:header].each do |header| %>
11
+ <th><%= header %></th>
12
12
  <% end %>
13
13
  </tr>
14
14
  </thead>
15
15
  <tbody>
16
- <% rows.each do |row| %>
17
- <tr>
18
- <% row.each_with_index do |cell, i| %>
19
- <td class="<%= slugify (header[i] || "") %>"><%= cell %></td>
20
- <% end %>
21
- </tr>
22
- <% end %>
23
16
  </tbody>
24
17
  </table>
25
-
18
+ <script>
19
+ $(document).ready(function(){
20
+ $('#table-<%= index %>').dataTable({
21
+ data: data_<%= index %>,
22
+ columns: [
23
+ <% report[:header].each do |header| %>
24
+ { data: '<%= header %>', className: '<%= slugify(header) %>' },
25
+ <% end %>
26
+ ]
27
+ });
28
+ });
29
+ </script>
@@ -0,0 +1,12 @@
1
+ <script>
2
+ /* this is used both by Vega and DataTable */
3
+ data_<%= index %> = [
4
+ <% report[:rows].each do |row| %>
5
+ {
6
+ <% report[:header].each_with_index do |h, i| %>
7
+ "<%= h %>": <%= (row[i].class == Integer or row[i].class == Float) ? row[i] : "\"#{row[i]}\"" %>,
8
+ <% end %>
9
+ },
10
+ <% end %>
11
+ ]
12
+ </script>
@@ -17,6 +17,8 @@
17
17
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.7.4/dist/css/foundation.min.css">
18
18
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/zf/dt-1.11.3/datatables.min.css"/>
19
19
 
20
+ <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
21
+ <script type="text/javascript" src="https://cdn.datatables.net/v/zf/dt-1.11.3/datatables.min.js"></script>
20
22
 
21
23
  <script src="https://cdn.jsdelivr.net/npm/vega@5.21.0"></script>
22
24
  <script src="https://cdn.jsdelivr.net/npm/vega-lite@5.2.0"></script>
@@ -426,7 +428,7 @@
426
428
  <%= report[:title] %>
427
429
  </h2>
428
430
  </div>
429
-
431
+ <%= render "report_data.html.erb", report: report, index: index %>
430
432
  <% if report[:vega_spec] %>
431
433
  <div id="<%= "plot-#{index}" %>"></div>
432
434
  <script>
@@ -436,22 +438,15 @@
436
438
  width: "container",
437
439
  description: "<%= report[:title] %>",
438
440
  data: {
439
- values: [
440
- <% report[:rows].each do |row| %>
441
- {
442
- <% report[:header].each_with_index do |h, i| %>
443
- "<%= h %>": <%= (row[i].class == Integer or row[i].class == Float) ? row[i] : "\"#{row[i]}\"" %>,
444
- <% end %>
445
- },
446
- <% end %>
447
- ]
441
+ values: data_<%= index %>
448
442
  },
449
443
  });
450
444
  vegaEmbed('#<%= "plot-#{index}"%>', plot_spec_<%= index %>);
451
445
  </script>
452
446
  <% end %>
453
- <div class="card-section">
454
- <%= render "output_table.html.erb", report %>
447
+
448
+ <div class="card-section">
449
+ <%= render "output_table.html.erb", report: report, index: index %>
455
450
  </div>
456
451
  </article>
457
452
  <% end %>
@@ -569,9 +564,7 @@
569
564
  </section>
570
565
  </div>
571
566
 
572
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
573
567
  <script type="text/javascript" src="js/vendor/what-input.js"></script>
574
- <script type="text/javascript" src="https://cdn.datatables.net/v/zf/dt-1.11.3/datatables.min.js"></script>
575
568
  <script src="https://cdn.jsdelivr.net/npm/vega@5"></script>
576
569
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/foundation-sites@6.7.4/dist/js/foundation.min.js" crossorigin="anonymous"></script>
577
570
  <script>
@@ -17,6 +17,8 @@
17
17
  <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/foundation-sites@6.7.4/dist/css/foundation.min.css">
18
18
  <link rel="stylesheet" type="text/css" href="https://cdn.datatables.net/v/zf/dt-1.11.3/datatables.min.css"/>
19
19
 
20
+ <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
21
+ <script type="text/javascript" src="https://cdn.datatables.net/v/zf/dt-1.11.3/datatables.min.js"></script>
20
22
 
21
23
  <script src="https://cdn.jsdelivr.net/npm/vega@5.21.0"></script>
22
24
  <script src="https://cdn.jsdelivr.net/npm/vega-lite@5.2.0"></script>
@@ -341,7 +343,7 @@
341
343
  <%= report[:title] %>
342
344
  </h2>
343
345
  </div>
344
-
346
+ <%= render "report_data.html.erb", report: report, index: index %>
345
347
  <% if report[:vega_spec] %>
346
348
  <div id="<%= "plot-#{index}" %>"></div>
347
349
  <script>
@@ -351,22 +353,14 @@
351
353
  width: "container",
352
354
  description: "<%= report[:title] %>",
353
355
  data: {
354
- values: [
355
- <% report[:rows].each do |row| %>
356
- {
357
- <% report[:header].each_with_index do |h, i| %>
358
- "<%= h %>": <%= (row[i].class == Integer or row[i].class == Float) ? row[i] : "\"#{row[i]}\"" %>,
359
- <% end %>
360
- },
361
- <% end %>
362
- ]
356
+ values: data_<%= index %>
363
357
  },
364
358
  });
365
359
  vegaEmbed('#<%= "plot-#{index}"%>', plot_spec_<%= index %>);
366
360
  </script>
367
361
  <% end %>
368
362
  <div class="card-section">
369
- <%= render "output_table.html.erb", report %>
363
+ <%= render "output_table.html.erb", report: report, index: index %>
370
364
  </div>
371
365
  </article>
372
366
  <% end %>
@@ -392,9 +386,7 @@
392
386
  </section>
393
387
  </div>
394
388
 
395
- <script type="text/javascript" src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
396
389
  <script type="text/javascript" src="js/vendor/what-input.js"></script>
397
- <script type="text/javascript" src="https://cdn.datatables.net/v/zf/dt-1.11.3/datatables.min.js"></script>
398
390
  <script src="https://cdn.jsdelivr.net/npm/vega@5"></script>
399
391
  <script type="text/javascript" src="https://cdn.jsdelivr.net/npm/foundation-sites@6.7.4/dist/js/foundation.min.js" crossorigin="anonymous"></script>
400
392
  <script>
@@ -1,3 +1,3 @@
1
1
  module LogSense
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
data/log_sense.gemspec CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
10
10
  spec.description = %q{Generate analystics in HTML, txt, and SQLite format from an Apache and Rails log files.}
11
11
  spec.homepage = "https://www.ict4g.net/gitea/adolfo/log_sense"
12
12
  spec.license = "MIT"
13
- spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
13
+ spec.required_ruby_version = Gem::Requirement.new(">= 2.6.9")
14
14
 
15
15
  spec.metadata["allowed_push_host"] = "https://rubygems.org/"
16
16
 
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.3.1
4
+ version: 1.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-12-24 00:00:00.000000000 Z
11
+ date: 2022-01-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: browser
@@ -124,6 +124,7 @@ files:
124
124
  - LICENSE.txt
125
125
  - README.org
126
126
  - Rakefile
127
+ - apache-screenshot.png
127
128
  - bin/console
128
129
  - bin/setup
129
130
  - exe/log_sense
@@ -143,6 +144,7 @@ files:
143
144
  - lib/log_sense/templates/_output_table.html.erb
144
145
  - lib/log_sense/templates/_performance.html.erb
145
146
  - lib/log_sense/templates/_performance.txt.erb
147
+ - lib/log_sense/templates/_report_data.html.erb
146
148
  - lib/log_sense/templates/_summary.html.erb
147
149
  - lib/log_sense/templates/_summary.txt.erb
148
150
  - lib/log_sense/templates/apache.html.erb
@@ -169,14 +171,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
169
171
  requirements:
170
172
  - - ">="
171
173
  - !ruby/object:Gem::Version
172
- version: 2.3.0
174
+ version: 2.6.9
173
175
  required_rubygems_version: !ruby/object:Gem::Requirement
174
176
  requirements:
175
177
  - - ">="
176
178
  - !ruby/object:Gem::Version
177
179
  version: '0'
178
180
  requirements: []
179
- rubygems_version: 3.2.32
181
+ rubygems_version: 3.0.3.1
180
182
  signing_key:
181
183
  specification_version: 4
182
184
  summary: Generate analytics from an Apache and Rails log file.