From 6f46060c9b25be78cf908ad733b289ab834dc1e1 Mon Sep 17 00:00:00 2001 From: Kyle Drake Date: Wed, 19 Sep 2018 17:47:51 -0700 Subject: [PATCH] work with gzipped logfiles --- models/stat.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/models/stat.rb b/models/stat.rb index c50f3aea..83e85f9f 100644 --- a/models/stat.rb +++ b/models/stat.rb @@ -1,4 +1,5 @@ require 'resolv' +require 'zlib' class Stat < Sequel::Model FREE_RETAINMENT_DAYS = 30 @@ -21,10 +22,11 @@ class Stat < Sequel::Model cache_control_ips = $config['cache_control_ips'] - Dir["#{path}/*.log"].each do |log_path| + Dir["#{path}/*.log.gz"].each do |log_path| site_logs = {} - logfile = File.open log_path, 'r' + gzfile = File.open log_path, 'r' + logfile = Zlib::GzipReader.new gzfile begin while hit = logfile.gets