HEX
Server: Apache/2.4.68 (Debian)
System: Linux as-cs-widget-demo-us-central1 6.1.0-44-cloud-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.164-1 (2026-03-09) x86_64
User: root (0)
PHP: 8.2.32
Disabled: NONE
Upload Files
File: //lib/google-cloud-sdk/lib/surface/logging/__pycache__/read.cpython-312.pyc
�

��a��j�dZddlmZddlmZddlmZddlmZddlmZddlm	Z	ddlm
Z
dd	lmZ
e
je
je
j j"e
j j$e
j j&�Gd
�de
j(���Zdd
d�e_y)z'logging read' command.�)�absolute_import)�division)�unicode_literals)�common)�util)�arg_parsers)�base)�readc�,�eZdZdZed��Zd�Zd�Zy)�ReadzRead log entries.c��tj|�tj|�|j�}|j	dtj�dd��|jd��}|j	ddd	d
��|j	ddd
��|j	ddd��tj|d�y)z Register flags for this command.z--resource-names�RESOURCEa!Resource name(s) to read logs from. A resource can either be an top-level resource (e.g., "projects/my-project") or a full log view resource path (e.g., "projects/my-project/locations/my-location/buckets/my-bucket/views/my-view"). Multiple resources can be specified, separated by a comma.)�type�metavar�helpzUThese arguments are used in conjunction with the parent to construct a view resource.)rz
--locationT�LOCATIONzmLocation of the log bucket. If this argument is provided then `--bucket` and `--view` must also be specified.)�requiredrrz--bucketziId of the log bucket. If this argument is provided then `--location` and `--view` must also be specified.)rrz--viewzeId of the view. If this argument is provided then `--location` and `--bucket` must also be specified.zlog entries to readN)
�
read_logs_lib�LogFilterPositionalArgs�LoggingReadArgs�add_mutually_exclusive_group�add_argumentr�ArgList�add_argument_groupr�
AddParentArgs)�parser�target_group�
view_groups   �lib/surface/logging/read.py�Argsz	Read.Args#s����)�)�&�1��!�!�&�)��6�6�8�L�����
�
 �
 �
"���	�	��0�0�%�1�&�J�������:�	�;������<��=�
�����>��?�
	���v�4�5�c	�d�tj|�}||jr
|jgngz
}|jd�rst	j
t	j
t	j
t	j|�d|j�d|j�d|j�}n)|jd�rd}nt	j|�}tjtj|d��xsd|j|j||j��S)	N�location�	locations�buckets�views�resource_names�AND)�operator)�order_by�limit�parentr')r�MakeTimestampFilters�
log_filter�IsSpecifiedr�CreateResourceName�GetParentFromArgsr#�bucket�viewr�	FetchLogs�JoinFilters�orderr+r')�self�args�filter_clausesr,s    r�_Runz	Read._RunHs���"�7�7��=�N��4�?�?�t���'��B�N����
�#��&�&�
�
!�
!��%�%��(�(��.��T�]�]�L�����&�(/��	�	�	;�f�

�	�	�*�	+��f��%�%�d�+�f�����!�!�.�5�A�I�T�����j�j���*�*�,�,r!c�$�|j|�S)z�This is what gets called when the user runs this command.

    Args:
      args: an argparse namespace. All the arguments that were provided to this
        command invocation.

    Returns:
      The list of log entries.
    )r:)r7r8s  r�RunzRead.Runas���9�9�T�?�r!N)�__name__�
__module__�__qualname__�__doc__�staticmethodr r:r<�r!rrrs$��
��"6��"6�H,�2
r!ra"        {command} reads log entries.  Log entries matching *log-filter* are
        returned in order of decreasing timestamps, most-recent entries first.
        If the log entries come from multiple logs, then entries from different
        logs might be intermingled in the results.
    a,        To read log entries from Google Compute Engine instances, run:

          $ {command} "resource.type=gce_instance"

        To read log entries with severity ERROR or higher, run:

          $ {command} "severity>=ERROR"

        To read log entries written in a specific time window, run:

          $ {command} 'timestamp<="2015-05-31T23:59:59Z" AND timestamp>="2015-05-31T00:00:00Z"'

        To read up to 10 log entries in your project's syslog log from Compute
        Engine instances containing payloads that include the word `SyncAddress`
        and format the output in `JSON` format, run:

          $ {command} "resource.type=gce_instance AND logName=projects/[PROJECT_ID]/logs/syslog AND textPayload:SyncAddress" --limit=10 --format=json

        To read a log entry from a folder, run:

          $ {command} "resource.type=global" --folder=[FOLDER_ID] --limit=1

        To read a log entry from a global log bucket, run:

          $ {command} --bucket=<bucket-id> --location=[LOCATION] --limit=1

        To read a log entry from the global ```_Required``` log bucket using the bucket's ```_Default``` log view:

          $ {command} "" --bucket=_Required --location=global --view=_Default --limit=1

        To read a log entry from a log bucket using the bucket's ```_AllLogs``` log view:

          $ {command} "" --bucket=[BUCKET_ID] --location=[LOCATION] --view=_AllLogs --limit=1

        To read a log entry from a log bucket using a custom log view that you have created for the bucket:

          $ {command} "" --bucket=[BUCKET_ID] --location=[LOCATION] --view=[VIEW_ID] --limit=1

        To read log entries from multiple resources, specify them as a
        comma-delimeted sequence with --resource-names. Each resource name can
        be specified either as a top-level resource (e.g.,
        projects/[PROJECT_ID], folders/[FOLDER_ID], etc.) or as a Log View
        resource (e.g.,
        projects/[PROJECT_ID]/locations/[LOCATION]/buckets/[BUCKET_NAME]/views/[VIEW_ID]).

          $ {command} "" --resource-names=[RESOURCE-1],[RESOURCE-2]

    )�DESCRIPTION�EXAMPLESN)r@�
__future__rrr�googlecloudsdk.api_lib.loggingrr�googlecloudsdk.callioperr	�googlecloudsdk.command_lib.logsr
r�UniverseCompatible�
ReleaseTracks�ReleaseTrack�ALPHA�BETA�GA�Commandr�
detailed_helprBr!r�<module>rQs����&��'�1�/�/�(�A�������������T�.�.�3�3�T�5F�5F�5I�5I��K�4�<�<�K���K�`	�0	�:��r!