How to see Google Cloud Compute Engine Logs - google-cloud-platform

How can I see the logs regarding the VMs that has been created on Google Cloud Compute Engine ?

Google Operations Logging (formerly Stackdriver) provides this information.
To see the details on Google Compute Engine instances that were created in a project, filter based upon the API operation v1.compute.instances.insert and the resouce type resource.type=gce_instance.
Note: the resouce type is not always necessary but it is best to be declarative in what logging should search for.
Example using the CLI:
gcloud logging read "resource.type=gce_instance protoPayload.methodName=v1.compute.instances.insert" --format json
Example using the Google Cloud Console - Legacy Logs Viewer
Go to https://console.cloud.google.com/logs/viewer
Verify that the desired Google Cloud project is displayed in the title area.
In the box showing the text "Filter by label or text search" click the dropdown and select "Convert to advanced filter".
In the box showing the text "Filter by label or text search" enter the following (as two lines in the filter box):
resource.type="gce_instance"
protoPayload.methodName="v1.compute.instances.insert"
Select the desired date search range in the box "Last hour"
Click the "Submit Filter" button

Related

Missing required parameter error while using Amazon SageMaker Ground Truth through AWS Console

We are hitting the following error when attempting to submit a single label text labeling job through SageMaker Ground Truth via the AWS Console: MissingRequiredParameter: Missing required key 'PreHumanTaskLambdaArn' in params.HumanTaskConfig
Input text files are present in S3, and clicking "Complete data setup" creates the manifest with no issues.
Amazon Mechanical Turk workers are selected as the Worker Type, with only the "Price per task" changed.
The task type is set to Text Classification (Single Label).
When setting up the "Text classification labeling tool (Single Label)", the preview shows the task exactly as we would expect to see it.

Get GCP Logging Log Viewer to highlight custom labels

A great feature in debugging Google Cloud Functions calls is the highlighting of the functionName and the execution id (see photo). Is it possible to also get your own logs (generated by the python logging client) to show up highlighted?
You can use summary fields to show these values
https://cloud.google.com/logging/docs/view/logs-viewer-interface#add_summary_fields

Check Google Cloud APIs & Services Error Log

Maybe I missed something, under https://console.cloud.google.com/apis/api/sqladmin.googleapis.com/overview
I saw there are a lot of errors, but when I go to Logs Viewer, I couldn't find anything. Is any way I can obtain the error log?
Basically, you should create a query to obtain the data you need in the Log Viewer UI: specify a type of resource and an instance name whose logs you want to view.
GCP Console => Operations => Logging => Logs Viewer
=> Query builder => Resource
Cloud SQL Database = my-project:my-sql-instance
The query builder will show a query preview like below:
resource.type="cloudsql_database"
resource.labels.database_id="my-project:my-sql-instance"
Once you click the “Run Query” button, the log entries will appear. By default log entries for the last 1 hour are shown. You can use the "Edit time" option to change this.
Please see Cloud Logging > Doc > Basic logs queries for more details.

Viewing all logs in stackdriver

I find myself toggling between different 'resources' to view my logs in stackdriver. For example:
Is there a way to view all combined logs from a single view? Most go to "Global", but many do not as well.
Just convert the filter to advanced view and select the resource types that you need
resource.type="bigquery_resource" OR resource.type="gce_instance" OR resource.type="audited_resource"
That will show you the logs for bigquery and audit and gce in a single view.
I believe you can do textual search across all logs, but it will not be as granular as resource type based search. You can try this with the Advanced filter feature.
On the top right corner of the search box, click the drop down menu and select "Convert to advanced filter". Then delete the "resource.type=xyz" line and type the string you want to search.
As alternative the gcloud sdk cli to search the logs without specifying resource type - for instance, gcloud logging read error --limit 1 would look for "error" string across all your logs and show only 1 matching entry.

Google Cloud ML Engine: Access Online Prediction Logs

I just created a model on ML Engine with:
gcloud ml-engine models create test_model --enable-logging
I went into the GUI and created a version. I'm hitting this model for predictions but where do I go in the GUI to find the logs for online predictions?
Thanks!
The logs can be found in StackDriver Logging:
Go to https://console.cloud.google.com
Click on the "hamburger" icon in the top left
Find the "Logging" option under "STACKDRIVER"
Click on "Logs" (you can get directly here with a link similar to: https://console.cloud.google.com/logs/viewer?project=my_project, just subsituate your actual project name)
Locate the drop down menu that allows you to select your logs.
Hover over "Cloud ML Model Version
Either click the model you're interested in or hover over it, if you want to select a specific version
(Optional) If selecting a specific version, click on it.
That said, I'll file a feature request to have a link in a more convenient place alongside the model and/or version.