ó
ôBQc @ s@ d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d l m Z d d
l m
Z
d d l m Z d d l
m Z d d
l
m Z d d l
m Z d d l
m Z d d l
m Z d d l
m Z d d l m Z d Z d e f d YZ d S( i˙˙˙˙( t Command( t COMMAND_NAME( t COMMAND_NAME_ALIASES( t CONFIG_REQUIRED( t FILE_URIS_OK( t MAX_ARGS( t MIN_ARGS( t PROVIDER_URIS_OK( t SUPPORTED_SUB_ARGS( t URIS_START_ARG( t CommandException( t HELP_NAME( t HELP_NAME_ALIASES( t HELP_ONE_LINE_SUMMARY( t HELP_TEXT( t HelpType( t HELP_TYPE( t NO_MAXs|
SYNOPSIS
gsutil enablelogging -b logging_bucket [-o log_object_prefix] uri...
DESCRIPTION
Google Cloud Storage offers access logs and storage data in the form of
CSV files that you can download and view. Access logs provide information
for all of the requests made on a specified bucket in the last 24 hours,
while the storage logs provide information about the storage consumption of
that bucket for the last 24 hour period. The logs and storage data files
are automatically created as new objects in a bucket that you specify, in
24 hour intervals.
The gsutil enablelogging command will enable access logging of the
buckets named by the specified uris, outputting log files in the specified
logging_bucket. logging_bucket must already exist, and all URIs must name
buckets (e.g., gs://bucket). For example, the command:
gsutil enablelogging -b gs://my_logging_bucket -o AccessLog \
gs://my_bucket1 gs://my_bucket2
will cause all read and write activity to objects in gs://mybucket1 and
gs://mybucket2 to be logged to objects prefixed with the name "AccessLog",
with those log objects written to the bucket gs://my_logging_bucket.
Note that log data may contain sensitive information, so you should make
sure to set an appropriate default bucket ACL to protect that data. (See
"gsutil help setdefacl".)
You can check logging status using the gsutil getlogging command. For log
format details see "gsutil help getlogging".
OPTIONS
-b bucket Specifies the log bucket.
-o prefix Specifies the prefix for log object names. Default value
is the bucket name.
t EnableLoggingCommandc B s e Z d Z i d e 6g e 6d e 6e e 6d e 6e e
6e e 6d e 6e
e 6Z i d e 6d d d g e 6e j e 6d e 6e e 6Z d Z RS(
s/ Implementation of gsutil enablelogging command.t
enableloggingi s b:o:i t loggingt logst logs Enable logging on bucketsc C se | j | j } | s' t d n d } d } xM | j D]B \ } } | d k rj | j j | } n | d k r= | } q= q= W| s t d n | j sł t d n t } x | j D]
} x| | j | j
D]e } | j r t d n t } d | GH| j
j d | | j | j | j | t | j qß WqĂ W| sat d n d
S( Ns5 enablelogging command spanning providers not allowed.s -bs -os/ enablelogging requires '-b ' options# -b option must specify a bucket uris* enablelogging cannot be applied to objectss Enabling logging on %s...R s No URIs matchedi ( t UrisAreForSingleProvidert argsR
t Nonet sub_optst suri_buildert
StorageUrit names_buckett Falset WildcardIteratort IterUrist names_objectt Truet proj_id_handlert FillInProjectHeaderIfNeededt headerst enable_loggingt bucket_name( t selft storage_urit target_bucket_urit
target_prefixt optt opt_argt
did_some_workt uri_strt uri( ( s: /tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/enablelogging.pyt
RunCommandr s8
( t __name__t
__module__t __doc__R R R R R R R R R R R" R t command_specR R R t COMMAND_HELPR R
t _detailed_help_textR t help_specR1 ( ( ( s: /tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/enablelogging.pyR L s$
N( t
gslib.commandR R R R R R R R R R t gslib.exceptionR
t gslib.help_providerR R R
R R R t
gslib.utilR R7 R ( ( ( s: /tmp/tmp.yUYbTOKr8o/gsutil/gslib/commands/enablelogging.pyt s&