google-cloud-stackdriver

Monitoring and alerting on pod status or restart with Google Container Engine (GKE) and Stackdriver

邮差的信 提交于 2020-08-01 03:07:52
问题 Is there a way to monitor the pod status and restart count of pods running in a GKE cluster with Stackdriver? While I can see CPU, memory and disk usage metrics for all pods in Stackdriver there seems to be no way of getting metrics about crashing pods or pods in a replica set being restarted due to crashes. I'm using a Kubernetes replica set to manage the pods, hence they are respawned and created with a new name when they crash. As far as I can tell the metrics in Stackdriver appear by pod

Log retention in Stackdriver GCP

拟墨画扇 提交于 2020-07-20 07:48:06
问题 How can I get log retention enabled in GCP Stack-driver. I haven't found any document for configuring log retention. I can see export option in logging section and log ingestion. 回答1: NOW, it is possible , see this post bellow (edited) Previous answer: Logging retention is 30 days and it is not configurable, you only pay for the storage Stackdriver Logging allows you to retain the logs for 30 days, and gives you a one-click configuration tool to archive data for a longer period in Google

Very slow “Logs” with Google Apps Script V8 vs Rhino?

北城余情 提交于 2020-07-04 13:00:06
问题 With Rhino, Logs dialog ("command + Enter" or Logs from View menu) shows logs instantly. However, with test projects using V8 engine it takes 10-20 seconds to load even the simplest logs, with a message "Waiting for logs, please wait..." Both, "Logger.log" or "console.log" are slow to load logs. Is anyone else experiencing the same type of slowness? Is this expected with the new engine? Thank you in advance! Here's a basic function I used for testing: function logTest() { Logger.log("log test

Stackdriver Logging API returns response code 200, but response is empty

依然范特西╮ 提交于 2020-06-29 06:56:57
问题 I'm trying to fetch stackdriver logs via Stackdriver Logging API v2. I do this by making a POST request from google apps script project, in particular using UrlFetchApp. The thing is, it runs successfully, but the response shown in log is empty. However, when I made the same request using apirequest.io, curl and Google API explorer, I got the necessary response. I searched extensively, but to no avail. Tried experimenting with header, url, but nothing. function exportLogs () { var options = {

Can't display data with with log-based metric

旧巷老猫 提交于 2020-06-16 17:26:09
问题 I’m struggling to create a chart with stackdriver monitoring with a log-based metric. My metric is a counter one with no unit by default. Logs are available for my log-based metric but when I create a chart with my metric, it says no data is available for the... . Here’s my metric which does work (called isOperatorAllowed): resource.type="container" resource.labels.namespace_id="default" jsonPayload.message="CaseForOperator flags" logName="projects/PROJECT-ID/logs/app" jsonPayload

Can't display data with with log-based metric

[亡魂溺海] 提交于 2020-06-16 17:25:31
问题 I’m struggling to create a chart with stackdriver monitoring with a log-based metric. My metric is a counter one with no unit by default. Logs are available for my log-based metric but when I create a chart with my metric, it says no data is available for the... . Here’s my metric which does work (called isOperatorAllowed): resource.type="container" resource.labels.namespace_id="default" jsonPayload.message="CaseForOperator flags" logName="projects/PROJECT-ID/logs/app" jsonPayload

Using Python to Query GCP Stackdriver logs

让人想犯罪 __ 提交于 2020-06-15 05:59:22
问题 I am using Python3 to query Stackdriver for GCP logs. Unfortunately, the log entries that have important data are returned to me as "NoneType" instead of as a "dict" or a "str". The resulting "entry.payload" is type "None" and the "entry.payload_pb" has the data I want, but it is garbled. Is there a way to get Stackdriver to return this data in a clean format, or is there a way I can parse it? If not, is there a way I should query this data that is better than what I am doing and yields clean

Duplicate log entries with Google Cloud Stackdriver logging of Python code on Kubernetes Engine

好久不见. 提交于 2020-05-25 04:29:20
问题 I have a simple Python app running in a container on Google Kubernetes Engine. I am trying to connect the standard Python logging to Google Stackdriver logging using this guide. I have almost succeeded, but I am getting duplicate log entries with one always at the 'error' level... Screenshot of Stackdriver logs showing duplicate entries This is my python code that set's up the logging according to the above guide: import webapp2 from paste import httpserver import rpc # Imports the Google

Duplicate log entries with Google Cloud Stackdriver logging of Python code on Kubernetes Engine

大兔子大兔子 提交于 2020-05-25 04:28:43
问题 I have a simple Python app running in a container on Google Kubernetes Engine. I am trying to connect the standard Python logging to Google Stackdriver logging using this guide. I have almost succeeded, but I am getting duplicate log entries with one always at the 'error' level... Screenshot of Stackdriver logs showing duplicate entries This is my python code that set's up the logging according to the above guide: import webapp2 from paste import httpserver import rpc # Imports the Google

Python Google Cloud Function Logging Severity and Duplicates

我怕爱的太早我们不能终老 提交于 2020-02-23 10:24:21
问题 I'm working on a simple Google Cloud Function that runs in the Python runtime and I want some simple logging from the Python program to Stackdriver Logging. Based on Google's startup guide, this should be straighforward https://cloud.google.com/logging/docs/setup/python I set up a simple test function to isolate the logging issues I'm seeing import google.cloud.logging def logging_test_background(data, context): logging_client = google.cloud.logging.Client() logging_client.setup_logging()