Hi I am trying to write a python script that does exactly what the following command does:
gcloud logging read "logName=projects/[project_name]/logs/[id]"
so when i run that command from the cli it does not give me any error, it outputs the logs as expected.
however when i run my python script:
import argparse
import datetime
import os
import sys
from pprint import pprint
from google.cloud import bigquery
from google.cloud import logging
assert "GOOGLE_APPLICATION_CREDENTIALS" in os.environ
def main():
client = logging.Client()
log_name = 'log_id'
logger = client.logger(log_name)
for entry in logger.list_entries():
print(entry.payload)
if __name__ == "__main__":
main()
I get the error: google.api_core.exceptions.PermissionDenied: 403 The caller does not have permission
Im not sure what to do here, since the command line runs, i clearly have permission. any thoughts would be greatly appreciated