Show only certain payload field in stackdriver logging webview
Asked Answered
S

1

16

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..

Subsidize answered 16/11, 2016 at 8:37 Comment(4)
Do you control the JSON? Renaming data to message should do what you want.Aluminium
@jelums, did you get any solution for your query?Faulty
Does anyone from Google look at these questions? This is a very basic feature that should absolutely exist.Zebulon
Have you seen "Add custom fields" section in cloud.google.com/logging/docs/view/overview. Does that help?Herbal
B
2

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.

Bonsai answered 25/10, 2019 at 15:51 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.