class AWS::S3::Logging::Log::Line
Each line of a log exposes the raw line, but it also has method accessors for all the fields of the logged request.
The list of supported log line fields are listed in the S3 documentation: docs.amazonwebservices.com/AmazonS3/2006-03-01/LogFormat.html
line = log.lines.first line.remote_ip # => '72.21.206.5'
If a certain field does not apply to a given request (for example, the key
field does not apply to a bucket request), or if it was unknown or unavailable, it will return nil
.
line.operation # => 'REST.GET.BUCKET' line.key # => nil
Constants
- DATE
- LINE_SCANNER
- QUOTED_STRING
- REST
Attributes
parts[R]
Public Instance Methods
attributes()
click to toggle source
Returns all fields of the line in a hash of the form :field_name => :field_value
.
line.attributes.values_at(:bucket, :key) # => ['marcel', 'kiss.jpg']
# File lib/aws/s3/logging.rb 200 def attributes 201 self.class.fields.inject({}) do |attribute_hash, field| 202 attribute_hash[field] = send(field) 203 attribute_hash 204 end 205 end
Private Instance Methods
parse()
click to toggle source
# File lib/aws/s3/logging.rb 210 def parse 211 scan(LINE_SCANNER).flatten.compact 212 end