Search code examples
pythongoogle-cloud-datastoregoogle-cloud-platformstackdriver

google cloud logging api not correctly filtering


Trying to pull logs for a daily cron job that backs up app engine data

from google.cloud.logging import Client, ASCENDING
from google.oauth2.service_account import Credentials

credentials = Credentials.from_service_account_info(PROJECT_SERVICE_ACCOUNT)
client = Client(project='project', credentials=credentials)

FILTER = 'protoPayload.taskName="frdskjfd84juks"'
for entry in client.list_entries(filter_=FILTER, order_by=ASCENDING):
    print entry.payload

The script appears to do nothing when run (does not print anything nor finish). The entries show up as expected in google cloud console stackdriver


Solution

  • Correctly pulled after changing to client.list_entries(filter_=FILTER, order_by=DESCENDING):

    I believe this is a bug on Google's end since with out the filter the script will run for an hour and terminate without outputting anything