OXIESEC PANEL
- Current Dir:
/
/
opt
/
gsutil
/
gslib
/
commands
/
__pycache__
Server IP: 2a02:4780:11:1594:0:ef5:22d7:a
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
02/11/2025 08:19:49 AM
rwxr-xr-x
📄
__init__.cpython-39.pyc
323 bytes
02/11/2025 08:19:49 AM
rw-r--r--
📄
acl.cpython-39.pyc
18.76 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
autoclass.cpython-39.pyc
6.01 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
bucketpolicyonly.cpython-39.pyc
6.75 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cat.cpython-39.pyc
4.17 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
compose.cpython-39.pyc
4.57 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
config.cpython-39.pyc
40.97 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cors.cpython-39.pyc
6.56 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
cp.cpython-39.pyc
42.21 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
defacl.cpython-39.pyc
11.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
defstorageclass.cpython-39.pyc
5.78 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
du.cpython-39.pyc
8.47 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
hash.cpython-39.pyc
7.87 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
help.cpython-39.pyc
6.41 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
hmac.cpython-39.pyc
12.39 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
iam.cpython-39.pyc
24.6 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
kms.cpython-39.pyc
14.88 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
label.cpython-39.pyc
10.46 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
lifecycle.cpython-39.pyc
6.37 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
logging.cpython-39.pyc
9.04 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
ls.cpython-39.pyc
18.81 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
mb.cpython-39.pyc
12.23 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
mv.cpython-39.pyc
5.06 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
notification.cpython-39.pyc
25.47 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
pap.cpython-39.pyc
6.53 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
perfdiag.cpython-39.pyc
62.18 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rb.cpython-39.pyc
3.78 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
requesterpays.cpython-39.pyc
5.53 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
retention.cpython-39.pyc
20.02 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rewrite.cpython-39.pyc
16.12 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rm.cpython-39.pyc
10.86 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rpo.cpython-39.pyc
5.96 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
rsync.cpython-39.pyc
53.86 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
setmeta.cpython-39.pyc
11.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
signurl.cpython-39.pyc
20.99 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
stat.cpython-39.pyc
5.04 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
test.cpython-39.pyc
17.73 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
ubla.cpython-39.pyc
6.96 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
update.cpython-39.pyc
12.26 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
version.cpython-39.pyc
5.25 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
versioning.cpython-39.pyc
5.51 KB
02/11/2025 08:19:49 AM
rw-r--r--
📄
web.cpython-39.pyc
7.63 KB
02/11/2025 08:19:49 AM
rw-r--r--
Editing: logging.cpython-39.pyc
Close
a +(Wg�3 � @ sT d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlZddlmZ ddl m Z dd lmZ dd l mZ ddlmZ ddlmZ dd lmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z ddl!m"Z" dZ#dZ$e#e$�%d� d Z&dZ'dZ(de' e( d Z)ee&e)�Z*ee$e(�Z+ee#e'�Z,G dd� de�Z-dS )z<Implementation of logging configuration command for buckets.� )�absolute_import)�print_function)�division)�unicode_literalsN)�encoding)�metrics)�Command)�CommandArgument)�ApiSelector)�CommandException)�NO_URLS_MATCHED_TARGET)�CreateHelpText)�StorageUrlFromString)�UrlsAreForSingleProvider)�storage_v1_messages)�NO_MAX)�GcloudStorageFlag)�GcloudStorageMap)� text_utilz� gsutil logging set on -b <logging_bucket_name> [-o <log_object_prefix>] gs://<bucket_name>... gsutil logging set off gs://<bucket_name>... z) gsutil logging get gs://<bucket_name> � a� <B>SET</B> The ``set`` sub-command has two sub-commands: <B>ON</B> The ``gsutil logging set on`` command enables usage and storage logging for the buckets named by the specified URLs, outputting log files to the bucket specified with the ``-b`` flag. Cloud Storage doesn't validate the existence of the output bucket, so users should ensure it already exists, and all URLs must name Cloud Storage buckets (e.g., ``gs://bucket``). The optional ``-o`` flag specifies the prefix for log object names. The default prefix is the bucket name. For example, the command: gsutil logging set on -b gs://my_logging_bucket -o UsageLog \ gs://my_bucket1 gs://my_bucket2 causes all read and write activity to objects in ``gs://mybucket1`` and ``gs://mybucket2`` to be logged to objects prefixed with the name ``UsageLog``, with those log objects written to the bucket ``gs://my_logging_bucket``. In addition to enabling logging on your bucket(s), you also need to grant cloud-storage-analytics@google.com write access to the log bucket, using this command: gsutil acl ch -g cloud-storage-analytics@google.com:W 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 defacl".) <B>OFF</B> This command disables usage and storage logging for the buckets named by the specified URLs. All URLs must name Cloud Storage buckets (e.g., ``gs://bucket``). No logging data is removed from the log buckets when you disable logging, but Google Cloud Storage stops delivering new logs once you have run this command. a6 <B>GET</B> If logging is enabled for the specified bucket url, the server responds with a JSON document that looks something like this: { "logBucket": "my_logging_bucket", "logObjectPrefix": "UsageLog" } You can download log data from your log bucket using the gsutil cp command. aM Google Cloud Storage offers `usage logs and storage logs <https://cloud.google.com/storage/docs/access-logs>`_ in the form of CSV files that you can download and view. Usage logs provide information for all of the requests made on a specified bucket and are created hourly. Storage logs provide information about the storage consumption of that bucket for the last day and are created daily. Once set up, usage logs and storage logs are automatically created as new objects in a bucket that you specify. Usage logs and storage logs are subject to the same pricing as other objects stored in Cloud Storage. For a complete list of usage log fields and storage data fields, see `Usage and storage log format <https://cloud.google.com/storage/docs/access-logs#format>`_. The ``logging`` command has two sub-commands: a� <B>OPTIONS</B> -b bucket_name Specifies the bucket that stores the generated logs. This flag is only available for the ``set on`` command and is required for that command. -o log_prefix Specifies a common prefix for the names of generated logs. This flag is only available for the ``set on`` command and is optional for that command. c @ s� e Zd ZdZejdg d�ededdddej ej gej edd d gd�e�� gd�Z ejdg d �ddeeed�d�Zeeg d�i d�eeg d�ed�ed�d�d�eg d�i d�d�i d�d�i d�Zdd� Zdd� Zdd� Zd d!� Zd"S )#�LoggingCommandz)Implementation of gsutil logging command.�logging)�disablelogging� enablelogging� getlogging� zb:o:Fr �mode�on�off)�choices)�command_name_aliases�usage_synopsis�min_args�max_args�supported_sub_args�file_url_ok�provider_url_ok�urls_start_arg�gs_api_support�gs_default_api�argparse_arguments)Z loggingconfigZlogs�logr r r �command_helpz(Configure or retrieve logging on buckets)�get�set)� help_name�help_name_aliases� help_type�help_one_line_summary� help_text�subcommand_help_text)�storage�buckets�describezk--format=gsutiljson[key=logging_config,empty=' has no logging configuration.',empty_prefix_key=storage_url])�gcloud_command�flag_map)r5 r6 �updatez--log-bucketz--log-object-prefix)�-b�-o)r5 r6 r: z--clear-log-bucketz--clear-log-object-prefix)r r c C s� | j | jd dgd�\}}|jdkrBtj| jj||jd�dd� n<|jrp|jjrp|jj rpt�t t�|j��� nt�d| � dS ) z(Gets logging configuration for a bucket.r r �� bucket_fields�s3)�provider� )�endz %s has no logging configuration.) �GetSingleBucketUrlFromArg�args�schemer �print_to_fd� gsutil_api�XmlPassThroughGetLoggingr � logBucket�logObjectPrefix�strr � MessageToJson)�self� bucket_url�bucket_metadata� rP �%/opt/gsutil/gslib/commands/logging.py�_Get� s"