apache_log_report 1.1.1 → 1.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a00134ccecff45a5213565360c91ff2b87c40af4b47bcdda18327ed556dfea86
4
- data.tar.gz: 6244d502e63bf9e699f2ad1f7188f17669d645125e15a7aa591815fa091f51b2
3
+ metadata.gz: 07ad311b79b7ad4888250d690af4857cc620b07a4fdc7206bbc40adf5b2fd00b
4
+ data.tar.gz: 1ed81f7bd6324af49a24ad6d8abe9add71710813c051537f254f80d9c9ac6739
5
5
  SHA512:
6
- metadata.gz: 3775358b99f42896eae739abf20898588c55026a64d5bac188ac9007a73767fc59c2f608d5a45fb05765bea3f3a2cdb8ae938a07d278232334edb85ba1ce2b5b
7
- data.tar.gz: 82c92ff76df83a14deb79443d8b19eb46b5b5e50e81cfb469c5eeac21e66d2b79ad91a51b1ecec6ac3aafa4dc33ebf2137d5dc1ce3ff988131f2c869b787ad35
6
+ metadata.gz: db323468d20cb50f870ac0dbe62cbfd42feb10e69da02d9d892dd206bcf9e5d1c3c5ad91a542f4f888bc04a9a6df3514ba186d67cc60b32e7647df6ff183e5d5
7
+ data.tar.gz: cf33e4665e31a6f18fc346c80b6f8b7cae8456b0c9dbf2d8c658a383b3711e754f795d08963d5c3c5109bd34360c5bc00bb17c93b15e4c551a7a9a1b5f619023
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- apache_log_report (1.1.0)
4
+ apache_log_report (1.1.2)
5
5
  apache_log-parser
6
6
  browser
7
7
  sqlite3
data/README.org CHANGED
@@ -14,10 +14,8 @@ See the [[file:CHANGELOG.org][CHANGELOG]] file.
14
14
 
15
15
  * Todo
16
16
 
17
- ** TODO Version information from command line and in reports
18
- ** TODO Refactor code from one giant class to more manageable chunkes
19
- ** TODO Move performance stats var to class (to isolate vars)
20
- ** TODO Check total number of days (which is not working, now)
17
+ ** TODO Graphs in HTML output
18
+ ** TODO Countries
21
19
 
22
20
  * Compatibility
23
21
 
@@ -23,21 +23,28 @@ end
23
23
  @started_at = Time.now
24
24
 
25
25
  @db = ApacheLogReport::LogParser.parse @log_file
26
- @data = ApacheLogReport::DataCruncher.crunch @db, @options
27
26
 
28
- @ended_at = Time.now
29
- @duration = @ended_at - @started_at
30
-
31
- @data = @data.merge({
32
- command: @command,
33
- log_file: @log_file,
34
- started_at: @started_at,
35
- ended_at: @ended_at,
36
- duration: @duration
37
- })
38
-
39
- #
40
- # Emit Output
41
- #
42
-
43
- puts ApacheLogReport::Emitter.emit @data, @options
27
+ if @options[:output_format] == "sqlite"
28
+ ddb = SQLite3::Database.new('db.sqlite3')
29
+ b = SQLite3::Backup.new(ddb, 'main', @db, 'main')
30
+ b.step(-1) #=> DONE
31
+ b.finish
32
+ else
33
+ @data = ApacheLogReport::DataCruncher.crunch @db, @options
34
+
35
+ @ended_at = Time.now
36
+ @duration = @ended_at - @started_at
37
+
38
+ @data = @data.merge({
39
+ command: @command,
40
+ log_file: @log_file,
41
+ started_at: @started_at,
42
+ ended_at: @ended_at,
43
+ duration: @duration
44
+ })
45
+
46
+ #
47
+ # Emit Output
48
+ #
49
+ puts ApacheLogReport::Emitter.emit @data, @options
50
+ end
@@ -71,6 +71,8 @@ module ApacheLogReport
71
71
  @ips = db.execute "SELECT ip, count(ip), count(distinct(unique_visitor)), #{human_readable_size} from LogLine where #{filter} group by ip order by count(ip) desc limit #{options[:limit]}"
72
72
  @referers = db.execute "SELECT referer, count(referer), count(distinct(unique_visitor)), #{human_readable_size} from LogLine where #{filter} group by referer order by count(referer) desc limit #{options[:limit]}"
73
73
 
74
+ @streaks = db.execute "SELECT ip, substr(datetime, 1, 10), path from LogLine order by ip, datetime"
75
+
74
76
  data = {}
75
77
  self.instance_variables.each do |variable|
76
78
  var_as_symbol = variable.to_s[1..-1].to_sym
@@ -50,7 +50,7 @@ module ApacheLogReport
50
50
  args[:code_export] = n
51
51
  end
52
52
 
53
- opts.on("-fFORMAT", "--format=FORMAT", String, "Output format: html, org. Defaults to org mode") do |n|
53
+ opts.on("-fFORMAT", "--format=FORMAT", String, "Output format: html, org, sqlite. Defaults to org mode") do |n|
54
54
  args[:output_format] = n
55
55
  end
56
56
 
@@ -26,9 +26,17 @@
26
26
  <th class="tx">Tx</th>
27
27
  <td class="tx"><%= data[:total_size][0][0] %></td>
28
28
  </tr>
29
+ <tr>
30
+ <th class="period">Period</th>
31
+ <td class="period">
32
+ <%= data[:first_day][0][0] %>
33
+ --
34
+ <%= data[:last_day][0][0] %>
35
+ </td>
36
+ </tr>
29
37
  <tr>
30
38
  <th class="days">Days </th>
31
- <td class="days"><%= data[:total_days][0][0] %></td>
39
+ <td class="days"><%= data[:total_days] %></td>
32
40
  </tr>
33
41
  </table>
34
42
  </article>
@@ -56,6 +64,34 @@
56
64
  </article>
57
65
  <% end %>
58
66
 
67
+ <article>
68
+ <h2>Streaks</h2>
69
+
70
+ <table class="streaks">
71
+ <thead>
72
+ <tr>
73
+ <th>IP</th>
74
+ <th>Day</th>
75
+ <th>URL</th>
76
+ </tr>
77
+ </thead>
78
+ <tbody>
79
+ <% data[:streaks].group_by(&:first).each do |ip, date_urls| %>
80
+ <tr>
81
+ <td class="ip"><%= ip %></td>
82
+ <td class="streaks">
83
+ <% date_urls.group_by(&:first).each do |date, urls| %>
84
+ <% urls.each do |url| %>
85
+ <b><%= url[1] %>:</b> <%= url[2] %> <br />
86
+ <% end %>
87
+ <% end %>
88
+ </td>
89
+ </tr>
90
+ <% end %>
91
+ </tbody>
92
+ </table>
93
+ </article>
94
+
59
95
  <article>
60
96
  <h2>Command Invocation and Performance</h2>
61
97
 
@@ -1,3 +1,3 @@
1
1
  module ApacheLogReport
2
- VERSION = "1.1.1"
2
+ VERSION = "1.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apache_log_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adolfo Villafiorita
@@ -118,7 +118,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  requirements: []
121
- rubygems_version: 3.0.3
121
+ rubygems_version: 3.2.22
122
122
  signing_key:
123
123
  specification_version: 4
124
124
  summary: Generate a request report in OrgMode format from an Apache log file.