Configure Postgres container logs to be sent to GCP Stackdriver

119 views
Skip to first unread message

Aniket Bhadane

unread,
Jun 3, 2019, 7:35:51 AM6/3/19
to Google Stackdriver Discussion Forum

I'm using GKE (Google Kubernetes Engine) on Google Cloud, and I have a Postgres container.

I want to configure Postgres to send its logs to Stackdriver in JSON format.

I did not find documentation for this, and I'm a newbie in Postgres. How can I do this?

Igor Peshansky

unread,
Jun 3, 2019, 9:19:45 AM6/3/19
to Aniket Bhadane, Google Stackdriver Discussion Forum
Not Stackdriver-specific, but a quick search unearthed this: https://paquier.xyz/postgresql-2/postgres-logs-json.markdown/ — perhaps it'll help.
        Igor
-- sent from a mobile device, please excuse tyops and omissns

--
© 2016 Google Inc. 1600 Amphitheatre Parkway, Mountain View, CA 94043
 
Email preferences: You received this email because you signed up for the Google Stackdriver Discussion Google Group (google-stackdr...@googlegroups.com) to participate in discussions with other members of the GoogleStackdriver community.
---
You received this message because you are subscribed to the Google Groups "Google Stackdriver Discussion Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-stackdriver-d...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/google-stackdriver-discussion/04c6fd48-963d-4906-b7d2-65bff6a76b67%40googlegroups.com.

Igor Peshansky

unread,
Jun 3, 2019, 9:31:02 AM6/3/19
to Aniket Bhadane, Google Stackdriver Discussion Forum
For completeness, a Stackdriver-recommended approach for transforming application logs on GKE is to run a sidecar container in your postgresql pods that reads the postgres log (presumably in csv format) from a shared volume, transforms it to JSON, and dumps it to its own stdout/stderr. That way you're in full control over the log format. See, for example, https://kubernetes.io/docs/concepts/cluster-administration/logging/#streaming-sidecar-container.

        Igor
-- sent from a mobile device, please excuse tyops and omissns

Kyle Bederka

unread,
Jun 3, 2019, 2:30:59 PM6/3/19
to Igor Peshansky, Aniket Bhadane, Google Stackdriver Discussion Forum
Hi Igor and Aniket,

Stackdriver partner, Blue Medora, is currently in Alpha moving to Beta for logs in Stackdriver with our BindPlane Service.

We currently support both Kubernetes and Postgres for Stackdriver Logs. We would love to hear more and help you view Postgres logs within Stackdriver in JSON format.

Happy to answer any questions you may have!





--
Kyle Bederka | Cloud Management Specialist 

Reply all
Reply to author
Forward
0 new messages