Use Cloud Logging with queues

You can use Cloud Logging with Cloud Tasks queues.

Turning on logging

Console

  1. Visit the Cloud Tasks console page.

    Cloud Tasks

  2. Find the queue for which you want to turn on logging and click the name.

  3. On the Queue Details page, select the Logs tab.

  4. Click Enable logs and confirm.

    screenshot

Gcloud

Cloud Logging can be turned on using a flag with either gcloud create or update:

gcloud tasks queues create QUEUE_ID --log-sampling-ratio=1.0

or

gcloud tasks queues update QUEUE_ID --log-sampling-ratio=1.0

where the log-sampling-ratio value indicates what percentage of the operations on the queue are logged. Setting it to any value between 1.0 and 0.0 logs that fraction of operations, where 1.0 logs all the operations and 0.0 logs none of them. 0.0 is the default setting.

Turning off logging

Console

  1. Visit the Cloud Tasks console page.

    Cloud Tasks

  2. Find the queue for which you want to turn off logging and click the name.

  3. On the Queue Details page, select the Logs tab.

  4. Click the three dot icon and Disable logs. Confirm.

    screenshot

Gcloud

Turn off logging by setting the flag to 0.0.

gcloud tasks queues update QUEUE_ID --log-sampling-ratio=0.0

Logged operations

The following operations are logged:

  • Task Operations
    • CreateTask
    • DeleteTask
  • Attempt Operations
    • AttemptDispatch
    • AttemptResponse

Viewing logs

To see the logs, go to the Logging > Logs Explorer page in the Google Cloud console:

Go to the Logs Explorer page

For information on viewing logs in the Logs Explorer, see Using the Logs Explorer.