Class AWS::S3::Logging::Log::Line
In: lib/aws/s3/logging.rb
Parent: String

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

Methods

Constants

DATE = /\[([^\]]+)\]/
QUOTED_STRING = /"([^"]+)"/
REST = /(\S+)/
LINE_SCANNER = /#{DATE}|#{QUOTED_STRING}|#{REST}/

Attributes

parts  [R] 

Public Instance methods

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']

[Source]

     # File lib/aws/s3/logging.rb, line 201
201:           def attributes
202:             self.class.fields.inject({}) do |attribute_hash, field|
203:               attribute_hash[field] = send(field)
204:               attribute_hash
205:             end
206:           end

[Validate]