Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Show only certain payload field in stackdriver logging webview

We use Stackdriver as our logging agent for a Docker environment that we have. Payload comes in form:

 structPayload: {
  container: {…}   
  data: "[2016-11-16 08:15:49] INFO Domain xxx apiKey validation passed."    
  instance: {…}    
 }

The web view gives me when looking at the logs:

{"container":{"id":"xxx","created":"2016-11-15T05:35:05.533105502Z",...

Is there a way to make the web view give me the container data listed, since clicking it open on all of the events is just stupid and time consuming.. Sometimes randomly in has been giving me just the data, but I can't figure it out how to do it..

like image 669
jelums Avatar asked Nov 16 '16 08:11

jelums


People also ask

Is Stackdriver same as cloud Logging?

This rebrand included renaming Google Stackdriver Monitoring to Google Cloud Monitoring and Google Stackdriver Logs to Google Cloud Logging.

How long are Stackdriver logs retained?

Stackdriver Logging does not retain logs forever. All logs are subject to a standard log retention period, after which they are deleted from Stackdriver. The retention period varies based on the type of log, with admin activity audit logs being retained for 400 days, and all other logs being retained for 30 days.

What is Stackdriver Logging and why is it important?

Stackdriver Logging is used by the Google Cloud Platform (GCP) and Amazon Web Services (AWS) to store, search, analyze, monitor, and alert log data and events. It is a fully managed service that performs at scale and you can ingest application and system log data from thousands of VM's in real time.

How do I check yarn logs in GCP?

Access job logs in Logging You can access Dataproc job logs using the Logs Explorer, the gcloud logging command, or the Logging API. Dataproc Job driver and YARN container logs are listed under are listed under the Cloud Dataproc Job resource.


1 Answers

You can configure the logs viewer to display custom fields, as documented here. However, it is not possible to remove the default fields from being displayed -- that said, custom-configured fields that are not defaults appear earlier in the list, so they should be easier to keep visible.

There are 2 methods to add a custom field:

The first is to click on the "View Options" and Select "Modify Custom Fields"

image of the drop down menup

You can then enter the name of the custom field you want to put on the main line, where it will be highlighted, for example, principalEmail. This can be a comma-separated list, and you can follow the JSON hierarchy with dots, if needed.

edit window for fields

The other method is to open a single entry, click on the field you would like to add, and select "Add field to summary line", like so:

add field to summary line image

Either way, the field is added to the URL, as the customFacets parameter, so that you can share or bookmark the URL to the log viewer.

like image 92
robsiemb Avatar answered Sep 22 '22 19:09

robsiemb