mirror of
https://github.com/neocities/neocities.git
synced 2025-04-25 09:42:36 +02:00
work with gzipped logfiles
This commit is contained in:
parent
0d4ebf42ac
commit
6f46060c9b
1 changed files with 4 additions and 2 deletions
|
@ -1,4 +1,5 @@
|
||||||
require 'resolv'
|
require 'resolv'
|
||||||
|
require 'zlib'
|
||||||
|
|
||||||
class Stat < Sequel::Model
|
class Stat < Sequel::Model
|
||||||
FREE_RETAINMENT_DAYS = 30
|
FREE_RETAINMENT_DAYS = 30
|
||||||
|
@ -21,10 +22,11 @@ class Stat < Sequel::Model
|
||||||
|
|
||||||
cache_control_ips = $config['cache_control_ips']
|
cache_control_ips = $config['cache_control_ips']
|
||||||
|
|
||||||
Dir["#{path}/*.log"].each do |log_path|
|
Dir["#{path}/*.log.gz"].each do |log_path|
|
||||||
site_logs = {}
|
site_logs = {}
|
||||||
|
|
||||||
logfile = File.open log_path, 'r'
|
gzfile = File.open log_path, 'r'
|
||||||
|
logfile = Zlib::GzipReader.new gzfile
|
||||||
|
|
||||||
begin
|
begin
|
||||||
while hit = logfile.gets
|
while hit = logfile.gets
|
||||||
|
|
Loading…
Add table
Reference in a new issue