google cloud platform – Python code to create a sink to export logs to given pub/sub topic

I wanted curated logs of all the n number of cloud functions to be stored in bigquery.

To which, I decided to follow these,
Step1: create a pub/sub topic.
Step2: export all cloud function logs by creating a sink to that pub/sub topic.(On console we can do this through log router)
Step3: Create a cloud function to read the logs from pub/sub and store in bigquery.

Youtube Ref(console approach): youtu.be/P5P016UW5mM

My requirement is to use python to complete every step mentioned above.I cannot use console.

I have created a new pub/sub topic using python.
Now I wanted help to create a sink to export logs to the given pub/sub topic using python.

Read more here: Source link