Loglines: Counter; status every 5s with counter.
This commit is contained in:
parent
9cee5add9e
commit
fa8f42940e
2 changed files with 4 additions and 3 deletions
|
@ -90,7 +90,7 @@ module LogAn::Inc
|
||||||
@select = LogAn::Inc::Select.new
|
@select = LogAn::Inc::Select.new
|
||||||
status = lambda do
|
status = lambda do
|
||||||
@select.at Time.now+5, &status
|
@select.at Time.now+5, &status
|
||||||
LogAn::Logging.info @select
|
LogAn::Logging.info :recv_lines => @logs.counter, :connections => @serv
|
||||||
@conf[:stores].each{|key, db| db.flush!}
|
@conf[:stores].each{|key, db| db.flush!}
|
||||||
end
|
end
|
||||||
status.call
|
status.call
|
||||||
|
|
|
@ -6,7 +6,7 @@ require 'logan'
|
||||||
|
|
||||||
module LogAn
|
module LogAn
|
||||||
class Loglines
|
class Loglines
|
||||||
attr_reader :env, :rdb, :dbs
|
attr_reader :env, :rdb, :dbs, :counter
|
||||||
|
|
||||||
def self.new *paras
|
def self.new *paras
|
||||||
ret = obj = super( *paras)
|
ret = obj = super( *paras)
|
||||||
|
@ -28,7 +28,7 @@ module LogAn
|
||||||
end
|
end
|
||||||
@rdb = @env[ 'rotates.db', :type => SBDB::Btree, :flags => SBDB::CREATE | SBDB::AUTO_COMMIT]
|
@rdb = @env[ 'rotates.db', :type => SBDB::Btree, :flags => SBDB::CREATE | SBDB::AUTO_COMMIT]
|
||||||
@queue = @env[ "newids.queue", :type => SBDB::Queue, :flags => SBDB::CREATE | SBDB::AUTO_COMMIT, :re_len => 16]
|
@queue = @env[ "newids.queue", :type => SBDB::Queue, :flags => SBDB::CREATE | SBDB::AUTO_COMMIT, :re_len => 16]
|
||||||
@dbs = {}
|
@dbs, @counter = {}, 0
|
||||||
self.hash_func = lambda {|k|
|
self.hash_func = lambda {|k|
|
||||||
[k.timestamp.to_i/60/60].pack 'N' # Hour-based rotation
|
[k.timestamp.to_i/60/60].pack 'N' # Hour-based rotation
|
||||||
}
|
}
|
||||||
|
@ -77,6 +77,7 @@ module LogAn
|
||||||
dat = [sid || 0x10, val].pack 'Na*'
|
dat = [sid || 0x10, val].pack 'Na*'
|
||||||
name = db_name id
|
name = db_name id
|
||||||
db( name)[ id.raw] = dat
|
db( name)[ id.raw] = dat
|
||||||
|
@counter += 1
|
||||||
@queue.push id.raw
|
@queue.push id.raw
|
||||||
end
|
end
|
||||||
alias emit put
|
alias emit put
|
||||||
|
|
Loading…
Reference in a new issue