apache_log_report 1.1.4 → 1.1.5

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: 8b90448ec269bd64d60c2323888fb77ea8ac7307a00198434119a6f0da605585
4
- data.tar.gz: 24569c78964b795478c50e5de01c4f42fb2be8f02c30911e4e81229a96917a55
3
+ metadata.gz: c4cd01d24bc31eb2fe1107781a94578b43210fdc7d63dd65190643e637dc8da1
4
+ data.tar.gz: f1889cc37617847862274bd3d65fab82662d5c8e988129a227ed80b1fe4b7887
5
5
  SHA512:
6
- metadata.gz: 604697690824080fbbed523f26c1727f969fcf791803ebd15d6838384c5c77edbcde25ad74fa47c2371c0690019745948b6d78f9f1a51e6742e51e35c5c5ba76
7
- data.tar.gz: b7d5a6940308a6a098cb61b9118cd17760592e299e091193b07a003ae87e6f7058ee1aab81aed2cadd65dcc07c6b64652ede126274be5be552dbbf0ca3ba11b1
6
+ metadata.gz: 520c9648ccd15f9a3bc0b1761989bb091bc81cf7f16eac6cf5bc5bb73c0aef3e47a03eafd85f468c08834dbf93163c4b750ef31d61b63d277f546afcd21082b2
7
+ data.tar.gz: a1833663a335da90513d1054117b9ca39b2f9802c021f7f75dda929312c00e32e7a3725901454c3a3f583839d0addbf511f08e421117f2317892fe1fe1f93628
@@ -39,12 +39,24 @@ module ApacheLogReport
39
39
  END AS size
40
40
  EOS
41
41
 
42
+ human_readable_day = <<-EOS
43
+ case cast (strftime('%w', datetime) as integer)
44
+ when 0 then 'Sunday'
45
+ when 1 then 'Monday'
46
+ when 2 then 'Tuesday'
47
+ when 3 then 'Wednesday'
48
+ when 4 then 'Thursday'
49
+ when 5 then 'Friday'
50
+ else 'Saturday'
51
+ end as dow
52
+ EOS
53
+
42
54
  @total_hits = db.execute "SELECT count(datetime) from LogLine where #{filter}"
43
55
  @total_unique_visitors = db.execute "SELECT count(distinct(unique_visitor)) from LogLine where #{filter}"
44
56
  @total_size = db.execute "SELECT #{human_readable_size} from LogLine where #{filter}"
45
57
  @total_days = (Date.parse(@last_day[0][0]) - Date.parse(@first_day[0][0])).to_i
46
58
 
47
- @daily_distribution = db.execute "SELECT date(datetime), count(datetime), count(distinct(unique_visitor)), #{human_readable_size} from LogLine where #{filter} group by date(datetime)"
59
+ @daily_distribution = db.execute "SELECT date(datetime), #{human_readable_day}, count(datetime), count(distinct(unique_visitor)), #{human_readable_size} from LogLine where #{filter} group by date(datetime)"
48
60
  @time_distribution = db.execute "SELECT strftime('%H', datetime), count(datetime), count(distinct(unique_visitor)), #{human_readable_size} from LogLine where #{filter} group by strftime('%H', datetime)"
49
61
  @most_requested_pages = db.execute "SELECT path, count(path), count(distinct(unique_visitor)), #{human_readable_size} from LogLine where extension == '.html' and #{filter} group by path order by count(path) desc limit #{options[:limit]}"
50
62
  @most_requested_resources = db.execute "SELECT path, count(path), count(distinct(unique_visitor)), #{human_readable_size} from LogLine where #{filter} group by path order by count(path) desc limit #{options[:limit]}"
@@ -10,42 +10,43 @@
10
10
  <link rel="stylesheet" href="https://unpkg.com/spectre.css/dist/spectre-icons.min.css">
11
11
  </head>
12
12
 
13
- <body class="container">
14
- <h1>Apache Log Analysis: <%= data[:log_file] || "stdin" %></h1>
15
-
16
- <nav>
17
- <ul class="nav">
18
- <li class="nav-item active">
19
- <a href="#">Navigation</a>
20
- <ul class="nav">
21
- <% [ "Summary",
22
- "Log Structure",
23
- "Daily Distribution",
24
- "Time Distribution",
25
- "Most Requested Pages",
26
- "Most Requested Resources",
27
- "404 on HTML Files",
28
- "404 on other Resources",
29
- "Attacks",
30
- "Statuses",
31
- "Daily Statuses",
32
- "Browsers",
33
- "Platforms",
34
- "Referers",
35
- "IPs"
36
- ].each do |item| %>
37
- <li class="nav-item">
38
- <a href="#<%= item.downcase.gsub(' ', '-') %>"><%= item %></a>
39
- </li>
40
- <% end %>
41
- </ul>
42
- </li>
43
- </ul>
44
- </nav>
45
-
46
- <section>
47
- <div class="columns">
48
- <article class="col-6 column">
13
+ <body>
14
+ <div class="container">
15
+ <nav>
16
+ <ul class="nav">
17
+ <li class="nav-item active">
18
+ <a href="#">Navigation</a>
19
+ <ul class="nav">
20
+ <% [ "Summary",
21
+ "Log Structure",
22
+ "Daily Distribution",
23
+ "Time Distribution",
24
+ "Most Requested Pages",
25
+ "Most Requested Resources",
26
+ "404 on HTML Files",
27
+ "404 on other Resources",
28
+ "Attacks",
29
+ "Statuses",
30
+ "Daily Statuses",
31
+ "Browsers",
32
+ "Platforms",
33
+ "Referers",
34
+ "IPs"
35
+ ].each do |item| %>
36
+ <li class="nav-item">
37
+ <a href="#<%= item.downcase.gsub(' ', '-') %>"><%= item %></a>
38
+ </li>
39
+ <% end %>
40
+ </ul>
41
+ </li>
42
+ </ul>
43
+ </nav>
44
+
45
+ <section>
46
+ <h1>Apache Log Analysis: <%= data[:log_file] || "stdin" %></h1>
47
+
48
+ <div class="columns">
49
+ <article class="col-6 column">
49
50
  <h2 id="summary">Summary</h2>
50
51
 
51
52
  <table class="table summary">
@@ -74,8 +75,8 @@
74
75
  <td class="days"><%= data[:total_days] %></td>
75
76
  </tr>
76
77
  </table>
77
- </article>
78
- <article class="column col-6">
78
+ </article>
79
+ <article class="column col-6">
79
80
  <h2 id="log-structure">Log Structure</h2>
80
81
 
81
82
  <table class="table log-structure">
@@ -102,43 +103,43 @@
102
103
  </tr>
103
104
  </tbody>
104
105
  </table>
105
- </article>
106
- </div>
107
-
108
- <% @reports = [
109
- { title: "Daily Distribution", header: ["Day", "Hits", "Visits", "Size"], rows: data[:daily_distribution] },
110
- { title: "Time Distribution", header: ["Hour", "Hits", "Visits", "Size"], rows: data[:time_distribution] },
111
- { title: "Most Requested Pages", header: ["Path", "Hits", "Visits", "Size"], rows: data[:most_requested_pages] },
112
- { title: "Most Requested Resources", header: ["Path", "Hits", "Visits", "Size"], rows: data[:most_requested_resources] },
113
- { title: "404 on HTML Files", header: ["Path", "Hits", "Visitors"], rows: data[:missed_pages] },
114
- { title: "404 on other Resources", header: ["Path", "Hits", "Visitors"], rows: data[:missed_resources] },
115
- { title: "Attacks", header: ["Path", "Hits", "Visitors"], rows: data[:attacks] },
116
- { },
117
- { title: "Statuses", header: ["Status", "Count"], rows: data[:statuses] },
118
- { title: "Daily Statuses", header: ["Status", "2xx", "3xx", "4xx"], rows: data[:statuses_by_day] },
119
- { title: "Browsers", header: ["Browser", "Hits", "Visitors", "Size"], rows: data[:browsers] },
120
- { title: "Platforms", header: ["Platform", "Hits", "Visitors", "Size"], rows: data[:platforms] },
121
- { title: "Referers", header: ["Referers", "Hits", "Visitors", "Size"], rows: data[:referers], col: "col-12" },
122
- { title: "IPs", header: ["IPs", "Hits", "Visitors", "Size"], rows: data[:ips] },
123
- { },
124
- ]
125
- %>
126
- <div class="columns">
127
- <% @reports.each do |report| %>
128
- <div class="column <%= report[:col] || "col-6" %>">
129
- <article>
130
- <% if report[:title] != nil %>
131
- <h2 id="<%= report[:title].downcase.gsub(/ +/, '-') %>">
132
- <%= report[:title] %>
133
- </h2>
134
- <%= render "output_table", report %>
135
- <% end %>
136
- </article>
137
- </div>
138
- <% end %>
139
- </div>
106
+ </article>
107
+ </div>
108
+
109
+ <% @reports = [
110
+ { title: "Daily Distribution", header: ["Day", "DOW", "Hits", "Visits", "Size"], rows: data[:daily_distribution] },
111
+ { title: "Time Distribution", header: ["Hour", "Hits", "Visits", "Size"], rows: data[:time_distribution] },
112
+ { title: "Most Requested Pages", header: ["Path", "Hits", "Visits", "Size"], rows: data[:most_requested_pages] },
113
+ { title: "Most Requested Resources", header: ["Path", "Hits", "Visits", "Size"], rows: data[:most_requested_resources] },
114
+ { title: "404 on HTML Files", header: ["Path", "Hits", "Visitors"], rows: data[:missed_pages] },
115
+ { title: "404 on other Resources", header: ["Path", "Hits", "Visitors"], rows: data[:missed_resources] },
116
+ { title: "Attacks", header: ["Path", "Hits", "Visitors"], rows: data[:attacks] },
117
+ { },
118
+ { title: "Statuses", header: ["Status", "Count"], rows: data[:statuses] },
119
+ { title: "Daily Statuses", header: ["Status", "2xx", "3xx", "4xx"], rows: data[:statuses_by_day] },
120
+ { title: "Browsers", header: ["Browser", "Hits", "Visitors", "Size"], rows: data[:browsers] },
121
+ { title: "Platforms", header: ["Platform", "Hits", "Visitors", "Size"], rows: data[:platforms] },
122
+ { title: "Referers", header: ["Referers", "Hits", "Visitors", "Size"], rows: data[:referers], col: "col-12" },
123
+ { title: "IPs", header: ["IPs", "Hits", "Visitors", "Size"], rows: data[:ips] },
124
+ { },
125
+ ]
126
+ %>
127
+ <div class="columns">
128
+ <% @reports.each do |report| %>
129
+ <div class="column <%= report[:col] || "col-6" %>">
130
+ <article>
131
+ <% if report[:title] != nil %>
132
+ <h2 id="<%= report[:title].downcase.gsub(/ +/, '-') %>">
133
+ <%= report[:title] %>
134
+ </h2>
135
+ <%= render "output_table", report %>
136
+ <% end %>
137
+ </article>
138
+ </div>
139
+ <% end %>
140
+ </div>
140
141
 
141
- <article>
142
+ <article>
142
143
  <h2 id="streaks">Streaks</h2>
143
144
 
144
145
  <table class="table streaks">
@@ -163,11 +164,11 @@
163
164
  <% end %>
164
165
  </tbody>
165
166
  </table>
166
- </article>
167
+ </article>
167
168
 
168
- <div class="columns">
169
- <div class="column col-6">
170
- <article>
169
+ <div class="columns">
170
+ <div class="column col-6">
171
+ <article>
171
172
  <h2 id="command-invocation">Command Invocation</h2>
172
173
 
173
174
  <table class="table command-invocation">
@@ -207,11 +208,11 @@
207
208
  </tr>
208
209
  </tbody>
209
210
  </table>
210
- </article>
211
- </div>
211
+ </article>
212
+ </div>
212
213
 
213
- <div class="column col-6">
214
- <article>
214
+ <div class="column col-6">
215
+ <article>
215
216
  <h2 id="performance"> Performance</h2>
216
217
 
217
218
  <table class="table performance">
@@ -241,10 +242,11 @@
241
242
  <td><%= "%.2f" % (data[:log_size][0][0] / data[:duration]) %></td></tr>
242
243
  </tbody>
243
244
  </table>
244
- </article>
245
+ </article>
246
+ </div>
245
247
  </div>
246
- </div>
247
- </section>
248
+ </section>
249
+ </div>
248
250
  </body>
249
251
  </html>
250
252
 
@@ -1,3 +1,3 @@
1
1
  module ApacheLogReport
2
- VERSION = "1.1.4"
2
+ VERSION = "1.1.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apache_log_report
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
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-10-31 00:00:00.000000000 Z
11
+ date: 2021-11-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: apache_log-parser