diff --git a/.idea/ApacheLogStats.iml b/.idea/ApacheLogStats.iml
index 0fcd036..bd3fe53 100644
--- a/.idea/ApacheLogStats.iml
+++ b/.idea/ApacheLogStats.iml
@@ -12,6 +12,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/main.rb b/main.rb
index 4fe5b14..016234c 100644
--- a/main.rb
+++ b/main.rb
@@ -4,7 +4,7 @@ require 'date'
require_relative 'utils/http_codes'
require_relative 'utils/date_for_humans'
-logfile = File.open("teambuilder.pt.log")
+logfile = File.open('teambuilder.pt.log')
data = logfile.read
lines = data.split("\n")
@@ -21,7 +21,7 @@ def get_line_date(line)
match = line.match(pattern)[0] if line.match(pattern)
# [12/Apr/2023:13:56:41 +0100] -> 12/Apr/2023:13:56:41 +0100
- Date.parse(match.gsub("[", "").gsub("]", ""))
+ Date.parse(match.gsub('[', '').gsub(']', ''))
end
# Gets the HTTP status code of the given log line
@@ -104,13 +104,13 @@ lines.each do |line|
end
top_user_agents = user_agents.sort_by { |ua, count| -count }.first(5)
-puts "Top 5 User-Agents contacting the site:"
+puts 'Top 5 User-Agents contacting the site:'
top_user_agents.each do |ua, count|
puts "#{ua}: #{count} visits"
end
top_client_errors = client_errors.sort_by { |ip, count| -count }.first(5)
-puts "Top 5 IPs with most client errors (400-499):"
+puts 'Top 5 IPs with most client errors (400-499):'
top_client_errors.each do |ip, count|
puts "#{ip}: #{count} errors"
end
\ No newline at end of file