Class: Fluent::Elb_LogInput
- Inherits:
-
Input
- Object
- Input
- Fluent::Elb_LogInput
- Defined in:
- lib/fluent/plugin/in_elb_log.rb
Defined Under Namespace
Classes: TimerWatcher
Constant Summary collapse
- LOGFILE_REGEXP =
/^((?<prefix>.+?)\/|)AWSLogs\/(?<account_id>[0-9]{12})\/elasticloadbalancing\/(?<region>.+?)\/(?<logfile_date>[0-9]{4}\/[0-9]{2}\/[0-9]{2})\/[0-9]{12}_elasticloadbalancing_.+?_(?<logfile_elb_name>[^_]+)_(?<elb_timestamp>[0-9]{8}T[0-9]{4}Z)_(?<elb_ip_address>.+?)_(?<logfile_hash>.+)\.log$/
- ACCESSLOG_REGEXP =
/^(?<time>.+?) (?<elb>.+?) (?<client>.+)\:(?<client_port>.+) (?<backend>.+)\:(?<backend_port>.+) (?<request_processing_time>.+?) (?<backend_processing_time>.+?) (?<response_processing_time>.+?) (?<elb_status_code>.+?) (?<backend_status_code>.+?) (?<received_bytes>.+?) (?<sent_bytes>.+?) \"(?<request_method>.+?) (?<request_uri>.+?) (?<request_protocol>.+?)\"$/
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fluent/plugin/in_elb_log.rb', line 15 def configure(conf) super require 'aws-sdk' if @access_key_id.nil? and has_not_iam_role? raise Fluent::ConfigError.new("access_key_id is required") end if @secret_access_key.nil? and has_not_iam_role? raise Fluent::ConfigError.new("secret_access_key is required") end raise Fluent::ConfigError.new("s3_bucketname is required") unless @s3_bucketname raise Fluent::ConfigError.new("timestamp_file is required") unless @timestamp_file end |
#shutdown ⇒ Object
44 45 46 47 48 49 |
# File 'lib/fluent/plugin/in_elb_log.rb', line 44 def shutdown super @loop.stop @thread.join @timestamp_file.close end |
#start ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fluent/plugin/in_elb_log.rb', line 30 def start super init_s3bucket @timestamp_file = File.open(@timestamp_file, File::RDWR|File::CREAT) @timestamp_file.sync = true @loop = Coolio::Loop.new timer_trigger = TimerWatcher.new(@refresh_interval, true, &method(:input)) timer_trigger.attach(@loop) @thread = Thread.new(&method(:run)) end |