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
|
||||
status = lambda do
|
||||
@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!}
|
||||
end
|
||||
status.call
|
||||
|
|
|
@ -6,7 +6,7 @@ require 'logan'
|
|||
|
||||
module LogAn
|
||||
class Loglines
|
||||
attr_reader :env, :rdb, :dbs
|
||||
attr_reader :env, :rdb, :dbs, :counter
|
||||
|
||||
def self.new *paras
|
||||
ret = obj = super( *paras)
|
||||
|
@ -28,7 +28,7 @@ module LogAn
|
|||
end
|
||||
@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]
|
||||
@dbs = {}
|
||||
@dbs, @counter = {}, 0
|
||||
self.hash_func = lambda {|k|
|
||||
[k.timestamp.to_i/60/60].pack 'N' # Hour-based rotation
|
||||
}
|
||||
|
@ -77,6 +77,7 @@ module LogAn
|
|||
dat = [sid || 0x10, val].pack 'Na*'
|
||||
name = db_name id
|
||||
db( name)[ id.raw] = dat
|
||||
@counter += 1
|
||||
@queue.push id.raw
|
||||
end
|
||||
alias emit put
|
||||
|
|
Loading…
Reference in a new issue