Class: Logflume::Flume
- Inherits:
-
Object
- Object
- Logflume::Flume
- Defined in:
- lib/logflume/flume.rb
Instance Attribute Summary collapse
-
#blocking ⇒ Object
Returns the value of attribute blocking.
-
#bookmark ⇒ Object
Returns the value of attribute bookmark.
-
#dir ⇒ Object
Returns the value of attribute dir.
-
#glob ⇒ Object
Returns the value of attribute glob.
-
#interval ⇒ Object
Returns the value of attribute interval.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#pipe ⇒ Object
Returns the value of attribute pipe.
-
#pipe_persist ⇒ Object
Returns the value of attribute pipe_persist.
-
#pre_load ⇒ Object
Returns the value of attribute pre_load.
-
#prefix_syslog ⇒ Object
Returns the value of attribute prefix_syslog.
-
#shift ⇒ Object
Returns the value of attribute shift.
-
#syslog_facility ⇒ Object
Returns the value of attribute syslog_facility.
-
#syslog_level ⇒ Object
Returns the value of attribute syslog_level.
-
#syslog_priority ⇒ Object
Returns the value of attribute syslog_priority.
-
#syslog_progname ⇒ Object
Returns the value of attribute syslog_progname.
-
#syslog_severity ⇒ Object
Returns the value of attribute syslog_severity.
-
#syslog_sourceip ⇒ Object
Returns the value of attribute syslog_sourceip.
Instance Method Summary collapse
- #configured? ⇒ Boolean
-
#initialize(opts = {}) ⇒ Flume
constructor
A new instance of Flume.
- #load ⇒ Object
- #running? ⇒ Boolean
- #shutdown ⇒ Object
- #start ⇒ Object
- #stop ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ Flume
Returns a new instance of Flume.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/logflume/flume.rb', line 5 def initialize(opts = {}) @dir = opts[:dir] || './flume/' @glob = opts[:glob] || '*.log' @logger = opts[:logger] || Logger.new(STDOUT) @interval = opts[:interval] || 5.0 @pre_load = opts[:pre_load] || false @blocking = opts[:blocking] || false @bookmark = opts[:bookmark] || false @shift = opts[:shift] || false @prefix_syslog = opts[:prefix_syslog] || false @syslog_sourceip = opts[:syslog_sourceip] || "127.0.0.1" @syslog_facility = opts[:syslog_facility] || "local7" @syslog_level = opts[:syslog_level] || "info" @syslog_priority = opts[:syslog_priority] || "info" @syslog_progname = opts[:syslog_progname] || "logflume" @pipe = opts[:pipe] || "/tmp/logflume.pipe.#{$$}" @pipe_persist = opts[:pipe_persist] || false @configured = false end |
Instance Attribute Details
#blocking ⇒ Object
Returns the value of attribute blocking.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def blocking @blocking end |
#bookmark ⇒ Object
Returns the value of attribute bookmark.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def bookmark @bookmark end |
#dir ⇒ Object
Returns the value of attribute dir.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def dir @dir end |
#glob ⇒ Object
Returns the value of attribute glob.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def glob @glob end |
#interval ⇒ Object
Returns the value of attribute interval.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def interval @interval end |
#logger ⇒ Object
Returns the value of attribute logger.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def logger @logger end |
#pipe ⇒ Object
Returns the value of attribute pipe.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def pipe @pipe end |
#pipe_persist ⇒ Object
Returns the value of attribute pipe_persist.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def pipe_persist @pipe_persist end |
#pre_load ⇒ Object
Returns the value of attribute pre_load.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def pre_load @pre_load end |
#prefix_syslog ⇒ Object
Returns the value of attribute prefix_syslog.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def prefix_syslog @prefix_syslog end |
#shift ⇒ Object
Returns the value of attribute shift.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def shift @shift end |
#syslog_facility ⇒ Object
Returns the value of attribute syslog_facility.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def syslog_facility @syslog_facility end |
#syslog_level ⇒ Object
Returns the value of attribute syslog_level.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def syslog_level @syslog_level end |
#syslog_priority ⇒ Object
Returns the value of attribute syslog_priority.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def syslog_priority @syslog_priority end |
#syslog_progname ⇒ Object
Returns the value of attribute syslog_progname.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def syslog_progname @syslog_progname end |
#syslog_severity ⇒ Object
Returns the value of attribute syslog_severity.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def syslog_severity @syslog_severity end |
#syslog_sourceip ⇒ Object
Returns the value of attribute syslog_sourceip.
3 4 5 |
# File 'lib/logflume/flume.rb', line 3 def syslog_sourceip @syslog_sourceip end |
Instance Method Details
#configured? ⇒ Boolean
25 26 27 |
# File 'lib/logflume/flume.rb', line 25 def configured? @configured end |
#load ⇒ Object
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/logflume/flume.rb', line 29 def load raise InvalidDirectory unless _directory_exists?(@dir) if @shift raise InvalidShiftDirectory unless _directory_exists?(@shift) end @dw = DirectoryWatcher.new(@dir, :glob => @glob, :logger => @logger, :interval => @interval, :pre_load => @pre_load) @dw.persist = @bookmark if @bookmark @configured = true unless @dw.nil? _route_pipe end |
#running? ⇒ Boolean
46 47 48 |
# File 'lib/logflume/flume.rb', line 46 def running? @dw.running? end |
#shutdown ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/logflume/flume.rb', line 54 def shutdown running? ? stop : true @dw = nil @configure = false _destroy_pipe unless @pipe_persist true end |
#start ⇒ Object
40 41 42 43 44 |
# File 'lib/logflume/flume.rb', line 40 def start load unless configured? _register_signal_hooks @dw.start end |
#stop ⇒ Object
50 51 52 |
# File 'lib/logflume/flume.rb', line 50 def stop @dw.stop end |