Class: Fluent::Plugin::Elb_LogInput
- Inherits:
-
Input
- Object
- Input
- Fluent::Plugin::Elb_LogInput
- Defined in:
- lib/fluent/plugin/in_elb_log.rb
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(.gz)?$/
- ACCESSLOG_REGEXP =
/^((?<type>[a-z0-9]+) )?(?<time>\d{4}-\d{2}-\d{2}T\d{2}\:\d{2}\:\d{2}\.\d{6}Z) (?<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>.+?)\"(\s+\"(?<user_agent>.+?)\" (?<ssl_cipher>.+?) (?<ssl_protocol>[^\s]+)( (?<target_group_arn>arn:\S+) (?<trace_id>[^\s]+))?( \"(?<domain_name>.+?)\" \"(?<chosen_cert_arn>.+?)\" (?<matched_rule_priority>.+?) (?<request_creation_time>.+?) \"(?<actions_executed>.+?)\" \"(?<redirect_url>.+?)\" \"(?<error_reason>[^\s]+)\"( |$))?((?<option1>[^\s]+)( |$))?((?<option2>[^\s]+)( |$))?( (?<option3>.*))?)?/
Instance Method Summary collapse
Instance Method Details
#configure(conf) ⇒ Object
32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/fluent/plugin/in_elb_log.rb', line 32 def configure(conf) super if !has_iam_role? raise Fluent::ConfigError.new("access_key_id is required") if @access_key_id.nil? raise Fluent::ConfigError.new("secret_access_key is required") if @secret_access_key.nil? end raise Fluent::ConfigError.new("s3_bucketname is required") unless @s3_bucketname raise Fluent::ConfigError.new("timestamp_file is required") unless @timestamp_file raise Fluent::ConfigError.new("s3 bucket not found #{@s3_bucketname}") unless s3bucket_is_ok? end |
#start ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/fluent/plugin/in_elb_log.rb', line 44 def start super # files touch File.open(@timestamp_file, File::RDWR|File::CREAT).close File.open(@buf_file, File::RDWR|File::CREAT).close timer_execute(:in_elb_log, @refresh_interval, &method(:input)) end |