module AWS::S3::Logging::Management::ClassMethods

Public Instance Methods

disable_logging(name = nil)
Alias for: disable_logging_for
disable_logging_for(name = nil) click to toggle source

Disables logging for the bucket named name.

    # File lib/aws/s3/logging.rb
251 def disable_logging_for(name = nil)
252   logging_status(bucket_name(name), Status.new)
253 end
Also aliased as: disable_logging
enable_logging(name = nil, options = {})
Alias for: enable_logging_for
enable_logging_for(name = nil, options = {}) click to toggle source

Enables logging for the bucket named name. You can specify what bucket to log to with the 'target_bucket' option as well as what prefix to add to the log files with the 'target_prefix' option. Unless you specify otherwise, logs will be delivered to the same bucket that is being logged and will be prefixed with log-.

    # File lib/aws/s3/logging.rb
241 def enable_logging_for(name = nil, options = {})
242   name            = bucket_name(name)
243   default_options = {'target_bucket' => name, 'target_prefix' => 'log-'}
244   options         = default_options.merge(options)
245   grant_logging_access_to_target_bucket(options['target_bucket'])
246   logging_status(name, Status.new(options))
247 end
Also aliased as: enable_logging
logging_enabled?(name = nil)
logging_enabled_for?(name = nil) click to toggle source

Returns true if logging has been enabled for the bucket named name.

    # File lib/aws/s3/logging.rb
257 def logging_enabled_for?(name = nil)
258   logging_status(bucket_name(name)).logging_enabled?
259 end
Also aliased as: logging_enabled?
logging_status(name = nil, status = nil)
Alias for: logging_status_for
logging_status_for(name = nil, status = nil) click to toggle source

Returns the logging status for the bucket named name. From the logging status you can determine the bucket logs are delivered to and what the bucket object's keys are prefixed with. For more information see the Logging::Status class.

Bucket.logging_status_for 'marcel'
    # File lib/aws/s3/logging.rb
227 def logging_status_for(name = nil, status = nil)
228   if name.is_a?(Status)
229     status = name
230     name   = nil
231   end
232 
233   path = path(name) << '?logging'
234   status ? put(path, {}, status.to_xml) : Status.new(get(path).parsed)
235 end
Also aliased as: logging_status
logs(name = nil, options = {})
Alias for: logs_for
logs_for(name = nil, options = {}) click to toggle source

Returns the collection of logs for the bucket named name.

Bucket.logs_for 'marcel'

Accepts the same options as Bucket.find, such as :max_keys and :marker.

    # File lib/aws/s3/logging.rb
267 def logs_for(name = nil, options = {})
268   if name.is_a?(Hash)
269     options = name
270     name    = nil
271   end
272   
273   name           = bucket_name(name)
274   logging_status = logging_status_for(name)
275   return [] unless logging_status.logging_enabled?
276   objects(logging_status.target_bucket, options.merge(:prefix => logging_status.target_prefix)).map do |log_object|
277     Log.new(log_object)
278   end
279 end
Also aliased as: logs