Google Error Reporting does not correlate to parent http request - google-app-engine

I'm using Google App Engine Standard with Python 3. When i click on an error in Google Error Reporting and then click "View Logs", I get taken to Google Logs Viewer/Explorer with something like this error_group("CObpg_HTfjskb6GA") as a search filter.
I see the individual log line with the stacktrace but not any logs for the parent request for which this occurred.
In the docs, they have a screenshot where it does look like we should be able to see the parent http request in which the error occurred: https://cloud.google.com/error-reporting/docs/viewing-errors#view_associated_log_entries
Right now when I need to look into an error, I have to do a separate search in logs explorer with part of the error message (in the case of the above example I'd search for "KeyError: 'c'") to find a duplicate log that has a trace id set. Then I'd be able to 'show all logs for trace' and be able to finally see all the logs that lead up to this error.
This feels related to this other issue from before, where logs in general in python3 were not getting correlated like they were in python2: How to group related request log entries GAE python 3.7 standard env
Logs now get grouped together via trace, but as far as I can tell, I cannot set trace on error report logs.
I have my logging setup by doing:
client = google.cloud.logging.Client()
client.setup_logging()
For error reporting I was just getting error reports from google.cloud.logging's integration with the python logger:
try:
# code where an error occurs
except Exception as exc:
logging.exception(exc)
raise
I've now started trying to use google-cloud-error-reporting to see if maybe there are some options in there that I can set to get it to correlate, but I seem to only be able to set a HttpContext & ReportingLocation. There isnt a spot for me to set trace or anything like that.

Related

How to join Google App Engine's logging table in BigQuery with Error Reporting

Google App Engine (GAE) creates a table for each day of logging with lines containing several logs information, such as "status" (e.g.: 500, 404), etc.
Yet, this table does not contain the Resolution Status for the errors in Error Reporting. E.g.:
At the moment, I would like to get how many "Acknowledged" errors happen per day. I can get which errors happen per day through the appengine_googleapis_com_request_log_* (e.g.: appengine_googleapis_com_request_log_20211130). However, I don't know how can I get if the error is Acknowledged or Open.
Does anyone know how can I combine those information, or at least if Error Reporting saves its information in any BigQuery table?
Reviewing Google documentation to help with your question, apparently, it is impossible to get the resolution status.
You can view your errors on the Error Reporting page of your GCP Console, which displays a list of all errors in the order of frequency. Errors with the same root cause are grouped together. The error reporting list provides the following information for all reported errors:
Resolution status
Occurrences
Users
Error
Seen in
First seen
Last seen
Response code
In case you would like to have more information, you can review the viewing error documentation.
Now, as I said, there is no way to get the resolution status; however, what you can try to do is a feature request.
Here is some documentation that shows what you can get with the API, it could help you with the feature request.
https://cloud.google.com/support/docs/issue-trackers
https://cloud.google.com/error-reporting/reference/rest/v1beta1/ErrorEvent
Additionally, here is a link I found regarding the Error Processing and Log Monitoring documentation using GCP.

delete_model() error when cleaning up AWS sagemaker

I followed the tutorial on https://aws.amazon.com/getting-started/hands-on/build-train-deploy-machine-learning-model-sagemaker/
I got an error when trying to clean up with the following code.
xgb_predictor.delete_endpoint()
xgb_predictor.delete_model()
ClientError: An error occurred (ValidationException) when calling the DescribeEndpointConfig operation: Could not find the endpoint configuration.
Does it mean I need to delete the model first instead?
I checked on the console and deleted the model manually.
No, you don't need to delete the model prior to deleting the endpoint. From the error logs looks like its not able to find the endpoint configuration. Can you verify if you are setting delete_endpoint_config to True
xgb_predictor.delete_endpoint(delete_endpoint_config=True)
Additionally, you can verify if the endpoint_config is still avaiable on the AWS console.

Attach tags or labels to stackdriver logs

I am using Standard AppEngine (Java) to develop a webservice. It seems that every request made to the service is automatically logged with stackdriver as a "request log", and each "request log" has multiple "application logs" attached to it .
I need to somehow pass in some additional information to be logged in stackdriver (like say the username of the person who made the request), and which can be later on extracted or scraped from stackdriver through a script.
I had 2 questions regarding this :
Is there anyway, I can attach this additional information to the request log ?
If I log the additional information as a normal log message which appears in the application log, is there a way to attach a distinguishing tag/label to the message, which will help me extract it easily and reliably ? (rather than relying on finding patterns in the text of the message itself)
1- Yes, you can add additional info as the application logs to the request log as it shows at: https://cloud.google.com/appengine/docs/standard/python/logs;
2- Looks you can add the tag or label to the log: https://cloud.google.com/logging/docs/api/tasks/creating-logs#writing_log_entries

on what error log settings can I find app error logs that google clould compute engine apps throw

I've deployed an app using googles cloud compute engine service.
I get an error when I try to register a new user:
We're sorry, but something went wrong. If you are the application owner check the logs for more information.
I'm in the logs section of the google cloud console and it has all sorts of random logs I can look at but I cant find where the errors that the app coding itself caused caused are put, e.g. I'm sure its a mail configuration problem that is causing the error message for new registered users but I cant fix the problem until I find out what the actual error is.
Where exactly are actual app errors put, because they aren't displayed on the page the like in production on my local computer. (I'm using a rails app if that makes a difference to anything)
All errors are logged in the logging section, try applying filters or sorting the logs by date. Sometimes they take a little while to appear.

App Engine logs showing HTTP 301 for nonexistent URLs

I am running a website on Google App Engine. From time to time I get out-of-control bots or perhaps brute force hacking attempts that I see in my logs. Recently I've had a bot (I presume) trying to access administrator/index.php several times a second. That file doesn't exist on my site. If I try to access it, I get the standard 404 and this in my logs:
But for the bot I am seeing HTTP 301 in the logs and I'm wondering why. Does Google interpret the requests as a denial of service or other attack and automatically intervene? I haven't seen documentation stating as much, but I'm not sure why else I would be seeing the 301 instead of 404 for the same URL:
Does anyone have an explanation for this?
The log entires shown on the screenshots can be clicked & expanded to view additional information. As mentioned in the comment above two things could be checked there for further analysis of what's going on:
check the hostname of where the request came to & see if it's not the expected behaviour for that hostname.
if the json object is shown, navigate to protoPayload -> line -> [0] -> logMessage where something like redirecting "http://example.com/" to "https://www.example.com/" should be shown which could also clear things up a bit.

Resources