stackdriver

How to log Stackdriver log messages correlated by trace id using stdout Go 1.11

≡放荡痞女 提交于 2021-02-06 11:56:08
问题 I'm using Google App Engine Standard Environment with the Go 1.11 runtime. The documentation for Go 1.11 says "Write your application logs using stdout for output and stderr for errors". The migration from Go 1.9 guide also suggests not calling the Google Cloud Logging library directly but instead logging via stdout. https://cloud.google.com/appengine/docs/standard/go111/writing-application-logs With this in mind, I've written a small HTTP Service (code below) to experiment logging to

No logs are created in Stackdriver logging

最后都变了- 提交于 2021-02-05 07:17:06
问题 In my google app script, I have: Logger.log("test"); and I even tried console.log("test"); But neither is printed to the stackdriver log, even after I've set the project id to a Google Cloud Project id. The screen shows: 回答1: To being able to see the logs on Stackdriver your project should have linked to a Google Cloud Standard project instad of the default project otherwise you only could see the "Stackdriver logs" on the executions pages in https://script.google.com From https://developers

Google Apps Script PropertiesService - Confused by unreliable Executions logging & editor debugging

假如想象 提交于 2021-01-29 09:34:18
问题 I find PropertiesService to be unreliable, but probably I'm just not familiar with Google Apps Script or Stackdriver and made a mistake or assumed something here that may caused the problem. Here's the script: sp = PropertiesService.getScriptProperties() sp.setProperties({ 'somekey': 'value' }) props = sp.getProperties() console.log(props.toString()) And here's the logs before I wrote this SO question: Type Start Time Duration Status Stackdriver Log Trigger Oct 9, 2020, 11:19:07 PM 0.541 s

Stackdriver Alerting Policy - Need To Filter On JSON Payload

瘦欲@ 提交于 2021-01-28 05:25:09
问题 I have a Python script set up under App Engine that runs through all of the projects within our organisation that collects data on: The disks not associated with snapshot policies The snapshot policies that do not have "daily" or "weekly" in their name (and are thus outside our naming convention) Taking the former as the example, the JSON payload within the Stackdriver log is like: jsonPayload: { DiskWithoutPolicy: "True" diskId: "1234567891234567891" diskName: "server-disk3" project:

Export custom collectd PostgreSQL metrics to GCP Stackdriver Monitoring

江枫思渺然 提交于 2021-01-27 17:48:44
问题 Background I'm trying to export PostgreSQL replication delay by adding a custom <Query> statement to my PostgreSQL config (original config from Stackdriver PostgreSQL Plugin) in stackdriver-agents collectd configuration directory. /opt/stackdriver/collectd/etc/postgresql.conf : # This is the monitoring configuration for PostgreSQL. # Make sure the statistics collector is enabled in your PostgreSQL configuration. # NOTE: This configuration needs to be hand-edited in order to work. # Look for

Using Nlog to write structured logs to Google Stackdriver

有些话、适合烂在心里 提交于 2021-01-27 15:04:26
问题 I'm using the Google.Cloud.Logging.NLog target to write logs to Stackdriver. I'd like to use Nlog & Stackdriver structured logging capabilities by sending a JSON payload as per the Stackdriver documentation: Logs are coming through but I don't seem to be populating the jsonPayload property in the logs, which will mean that I'm not sending a JSON payload. Do I need to configure a JsonLayout for every type of log message stated below? Target code GoogleStackdriverTarget googleTarget = new

Obtain Slack auth_token for Terraform google_monitoring_notification_channel resource

邮差的信 提交于 2021-01-21 06:32:04
问题 I'm looking to set up some alerts from gcloud -> slack, and so far have a test up and running having followed these instructions: https://cloud.google.com/monitoring/support/notification-options?_ga=2.190773474.-879257953.1550134526#slack However, ideally I'd store the config for these notifications in a terraform script so that I don't have manual steps to follow if things need setting up again. It looks like this should be possible: https://www.terraform.io/docs/providers/google/r

Custom OpenCensus metrics not appearing on Stackdriver

扶醉桌前 提交于 2020-12-12 18:14:08
问题 I'm trying to send custom metrics to Stackdriver from my Go application using OpenCensus. I've followed the guide, so the views and exporter are setup: import ( "context" "contrib.go.opencensus.io/exporter/stackdriver" "github.com/pkg/errors" "go.opencensus.io/stats" "go.opencensus.io/stats/view" "time" ) var ( apiRequestDurationMs = stats.Int64("api_request_duration", "API request duration in milliseconds", stats.UnitMilliseconds) ) func NewMetricsExporter() (*stackdriver.Exporter, error) {

Custom OpenCensus metrics not appearing on Stackdriver

☆樱花仙子☆ 提交于 2020-12-12 18:13:13
问题 I'm trying to send custom metrics to Stackdriver from my Go application using OpenCensus. I've followed the guide, so the views and exporter are setup: import ( "context" "contrib.go.opencensus.io/exporter/stackdriver" "github.com/pkg/errors" "go.opencensus.io/stats" "go.opencensus.io/stats/view" "time" ) var ( apiRequestDurationMs = stats.Int64("api_request_duration", "API request duration in milliseconds", stats.UnitMilliseconds) ) func NewMetricsExporter() (*stackdriver.Exporter, error) {

Custom OpenCensus metrics not appearing on Stackdriver

落花浮王杯 提交于 2020-12-12 18:08:11
问题 I'm trying to send custom metrics to Stackdriver from my Go application using OpenCensus. I've followed the guide, so the views and exporter are setup: import ( "context" "contrib.go.opencensus.io/exporter/stackdriver" "github.com/pkg/errors" "go.opencensus.io/stats" "go.opencensus.io/stats/view" "time" ) var ( apiRequestDurationMs = stats.Int64("api_request_duration", "API request duration in milliseconds", stats.UnitMilliseconds) ) func NewMetricsExporter() (*stackdriver.Exporter, error) {