Method: Aws::S3::Bucket#enable_logging
- Defined in:
- lib/s3/bucket.rb
#enable_logging(params) ⇒ Object
Enables S3 server access logging on a bucket. The target bucket must have been properly configured to receive server access logs.
Params:
:targetbucket - either the target bucket object or the name of the target bucket
:targetprefix - the prefix under which all logs should be stored
bucket.enable_logging(:targetbucket=>"mylogbucket", :targetprefix=>"loggylogs/")
=> true
87 88 89 90 91 92 |
# File 'lib/s3/bucket.rb', line 87 def enable_logging(params) Utils.mandatory_arguments([:targetbucket, :targetprefix], params) Utils.allow_only([:targetbucket, :targetprefix], params) xmldoc = "<?xml version=\"1.0\" encoding=\"UTF-8\"?><BucketLoggingStatus xmlns=\"http://doc.s3.amazonaws.com/2006-03-01\"><LoggingEnabled><TargetBucket>#{params[:targetbucket]}</TargetBucket><TargetPrefix>#{params[:targetprefix]}</TargetPrefix></LoggingEnabled></BucketLoggingStatus>" @s3.interface.put_logging(:bucket => @name, :xmldoc => xmldoc) end |