I'm trying to get GCP stackdriver logs from python module. I can filter logs from request_id and user
but when I'm trying to get logs between two time periods it gives my error.
import json
import sys
from google.cloud import logging
from google.cloud.logging import DESCENDING
from google.cloud import bigquery
#stackdriver client object
logging_client = logging.Client()
FILTER="logName:projects/cognitedata-europe-west1-1/logs/stdout AND timestamp>="+sys.argv[3]
results_iterator = logging_client.list_entries(filter_=FILTER,projects=PROJECT_IDS,order_by=DESCENDING,page_size=1000)
I use following pattens to provide time.
timestamp:sys.argv[3]
timestamp=sys.argv[3]
timestamp>sys.argv[3]
timestamp>=sys.argv[3]
But noting solves my issue.
I have input time for sys.argv3 as "2019-09-28T03:28:04.189Z"
My requirement is to filter data from the timestamp

But in GCP stack driver logger UI it gives results for both
timestamp:"2019-09-28T03:28:04.189Z"
and
timestamp>="2019-09-28T03:28:04.189Z" AND timestamp<="2019-09-28T03:30:39.189Z"


FILTER="timestamp>=2019-09-28T03:28:04.189Z(NB the value is not quoted) but you wantFILTER="timestamp>=2019-09-28T03:28:04.189Z". You want:...AND timestamp>=\""+sys.argv[3]\""- DazWilkin