Sha256: d2ef81c613205324733bcd401be37b105e884b8adb5647e7a70b930837d3fd1b
Contents?: true
Size: 775 Bytes
Versions: 5
Compression:
Stored size: 775 Bytes
Contents
module TreasureData module Command def sample_apache(op) fname = op.cmd_parse require 'json' t = Time.now.to_i i = 0 last_time = nil data = File.join(File.dirname(__FILE__), '../../../data/sample_apache.json') File.open(data) {|df| File.open(fname, 'w') {|of| df.each_line {|line| record = JSON.parse(line) record['time'] = last_time = (t - (i**1.3)).to_i of.puts record.to_json i += 1 } } } $stderr.puts "Create #{fname} with #{i} records whose time is" $stderr.puts "from #{Time.at(last_time)} to #{Time.at(t)}." $stderr.puts "Use '#{$prog} " + Config.cl_apikey_string + "table:import <db> <table> --json #{fname}' to import this file." end end end
Version data entries
5 entries across 5 versions & 1 rubygems
Version | Path |
---|---|
td-0.11.1 | lib/td/command/sample.rb |
td-0.10.99 | lib/td/command/sample.rb |
td-0.10.98 | lib/td/command/sample.rb |
td-0.10.97 | lib/td/command/sample.rb |
td-0.10.96 | lib/td/command/sample.rb |