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__/tail.cpython-312.pyc
�

��
���dZddlmZddlmZddlmZddlZddlmZddlm	Z	ddlm
Z
dd	lmZdd
lm
Z
ddlmZdZd
�ZGd�dej$�Ze
j(e
j*e
j,j.e
j,j0�Gd�de
j2���Zddd�e_y)z'logging 'tail' command.�)�absolute_import)�division)�unicode_literalsN)�util)�arg_parsers)�base)�
exceptions)�log)�	platformszYhttps://cloud.google.com/logging/docs/reference/tools/gcloud-logging#install_live_tailingc�:�tjj�}|tjjk(ry|tjjtjj
fvrdj
t�Sdj
t�S)zAReturns platform-specific guidance on setup for the tail command.zIThe installation of the Cloud SDK is corrupted, and gRPC is inaccessible.z�Please ensure that the gRPC module is installed and the environment is correctly configured. Run:
  sudo pip3 install grpcio
and set:
  export CLOUDSDK_PYTHON_SITEPACKAGES=1
For more information, see {}z�Please ensure that the gRPC module is installed and the environment is configured to allow gcloud to use the installation. For help, see {})r�OperatingSystem�Current�WINDOWS�LINUX�MACOSX�format�_TAILING_INSTALL_LINK)�
current_oss �lib/surface/logging/tail.py�_GrpcSetupHelpMessager!s����(�(�0�0�2�*��9�,�,�4�4�4�
��I�-�-�3�3��-�-�4�4�6�6�	P�
�f�
"�#�	$�M�
�F� �!�"�c�"��eZdZdZ�fd�Z�xZS)�NoGRPCInstalledErrorz$Unable to import grpc-based modules.c�<��tt|�t��y)N)�superr�__init__r)�self�	__class__s �rrzNoGRPCInstalledError.__init__>s���	�
��.�/D�/F�Gr)�__name__�
__module__�__qualname__�__doc__r�
__classcell__)rs@rrr;s���,�H�Hrrc�,�eZdZdZed��Zd�Zd�Zy)�TailzTail log entries.c�D�|jddd��|jddtj�d��|jd	�
�}|jddd
d��|jddd��|jddd��t	j
|d�y)z!Registers flags for this command.�
log_filterz�Filter expression that specifies the log entries to return. A detailed guide on the Logging query language can be found at: https://cloud.google.com/logging/docs/view/logging-query-language.�?)�help�nargsz--buffer-windowFa>The duration of time for which entries should be buffered for ordering before being returned. A longer buffer window helps to return logs in chronological order, but it also increases the latency from when entries are received by Cloud Logging to when they are returned. If unset, Cloud Logging will use 2s by default.)�required�typer)zUThese arguments are used in conjunction with the parent to construct a view resource.)r)z
--locationT�LOCATIONzjLocation of the bucket. If this argument is provided, then `--bucket` and `--view` must also be specified.)r+�metavarr)z--bucketzfId of the bucket. If this argument is provided, then `--location` and `--view` must also be specified.)r+r)z--viewzfId of the view. If this argument is provided, then `--location` and `--bucket` must also be specified.zlog entries to tailN)�add_argumentr�Duration�add_argument_groupr�
AddParentArgs)�parser�
view_groups  r�Argsz	Tail.ArgsGs�������
Q���������
�
!�
!�
#�
��
��*�*�%�+�&�J�������:�	�;������<��=�
�����>��?�	���v�4�5rc	���	ddlm}tj
j
d�tj|�}|jd�r_tjtjtj|d|j�d|j�d|j�}d}|jr?|jdks|jdkDrt	jd	�|j}|j!�}t	j"t$j&�|j)|g|j*xsd
|��S#t$rt��wxYw)Nr)�tailingzInitializing tail session.�location�	locations�buckets�views�<z0The buffer window must be set between 0s and 1m.�)�buffer_window_seconds)�googlecloudsdk.api_lib.loggingr7�ImportErrorrr
�err�Printr�GetParentFromArgs�IsSpecified�CreateResourceNamer8�bucket�view�
buffer_window�error�	LogTailer�SetLogFileVerbosity�logging�WARNING�TailLogsr')r�argsr7�parentr>�tailers      r�_Runz	Tail._Runts,��#�8�
�G�G�M�M�.�/�
�
#�
#�D�
)�F����
�#��&�&�
�
!�
!��%�%�f�k�4�=�=�I�����&�'.��	�	�;�f�!�����	
�	�	�a�	�4�#5�#5��#:��	�	�D�E�"�0�0��
�
�
�
 �F�
���G�O�O�,��?�?�	������2�3��5�5��+�#� �"�"�#�s�E�E#c�$�|j|�S)z�Gets called when the user runs this command.

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

    Returns:
      An iterator of log entries.
    )rR)rrOs  r�RunzTail.Run�s���9�9�T�?�rN)rr r!r"�staticmethodr5rRrT�rrr%r%Bs$����*6��*6�X5�>
rr%a�
         {command} streams newly received log entries. Log entries matching
         `log-filter` are returned in the order that Cloud Logging received
         them. If the log entries come from multiple logs, then entries from
         different logs might be mixed in the results. To help return log
         entries in order, use `--buffer-window`.

         Before you can use {command}, you must complete the installation
         instructions at
         [Live tailing log entries](https://cloud.google.com/logging/docs/reference/tools/gcloud-logging#live-tailing).

         For the quotas and limits associated with {command},
         see [Logging API quotas and limits](https://cloud.google.com/logging/quotas#api-limits).
    a�        To stream log entries from Google Compute Engine instances, run:

          $ {command} "resource.type=gce_instance"

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

          $ {command} "severity>=ERROR"

        To stream log entries with severity ERROR but only output the timestamps
        and instance IDs, run:

          $ {command} "severity>=ERROR" --format="default(timestamp,resource["labels"]["instance_id"])"

        To stream with minimal latency but potentially incorrect ordering:

          $ {command} "resource.type=gce_instance" --buffer-window=0s

        To stream 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 log_id(syslog) AND textPayload:SyncAddress" --format=json

        To stream log entries from a folder, run:

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

        Detailed information about filters can be found at:
        https://cloud.google.com/logging/docs/view/logging-query-language
    )�DESCRIPTION�EXAMPLES)r"�
__future__rrrrLr?r�googlecloudsdk.callioperrr	�googlecloudsdk.corer
�googlecloudsdk.core.utilrrr�
ToolExceptionr�DefaultUniverseOnly�
ReleaseTracks�ReleaseTrack�ALPHA�BETA�Commandr%�
detailed_helprVrr�<module>res����&��'��/�/�(�.�#�.�s��"�4H�:�3�3�H��������D�%�%�+�+�T�->�->�-C�-C�D�Y�4�<�<�Y�E��Y�|
	�	�#0��r