# -*- encoding: utf-8 -*- require 'json' require 'msgpack' require 'digest/md5' require 'cgi' require 'uuidtools' require 'fileutils' require 'zlib' require 'parallel' RECORDS = 5000 HOSTS = RECORDS/4 PAGES = RECORDS/4 AGENT_LIST_STRING = < host.ip, 'user' => '-', 'method' => page.method, 'path' => page.path, 'code' => grand(10000) == 0 ? 500 : page.code, 'referer' => (grand(2) == 0 ? @pages[grand(@pages.size)].path : page.referer) || '-', 'size' => page.size, 'agent' => host.agent, } puts record.to_json #puts %[#{record['host']} - #{record['user']} [#{Time.at(now).strftime('%d/%b/%Y:%H:%M:%S %z')}] "#{record['method']} #{record['path']} HTTP/1.1" #{record['code']} #{record['size']} "#{record['referer']}" "#{record['agent']}"] end