I've been studying logs in Logs Explorer in Google Cloud Platform and noticed that available logs don't show the body of a POST request, which is crucial for my task (I run Google Tag Manager Server-Side and need to study logs of all inbound Measurement Protocol requests). Is there a way to enable the body contents for requests like this one?
Asked
Active
Viewed 3,441 times
4

Eugene Krall
- 503
- 5
- 20
-
Possible duplicate of https://stackoverflow.com/questions/38055216/view-the-arguments-of-a-post-request-in-google-app-engine-logs ? I don't know if something changed since 2017... – norbjd Apr 07 '21 at 13:22
-
1Which service are you using? App Engine? – guillaume blaquiere Apr 07 '21 at 19:13
-
@guillaume-blaquiere Yes, I use App Engine Flexible – Eugene Krall Apr 07 '21 at 20:12
1 Answers
1
There's no built in feature in GCP Logging to do this just as norbjd said.
Only thing that's being logged by default are GET requests and only the first line:
First line of the request, containing method, path, and HTTP version. Example: GET / HTTP/1.1
Have a look at the answer here and then the fallowing comments fallowing:
A
logging.info()
shows up (link)
I have, and it does show up (with an i left to it) in the Stackdriver request logs and that is the only way to see POST arguments (link)
You may also try a solution from the next answer:
post request data isn't shown in request logs.
In your app, you must explicitly log it
logging.log(myRequest.PostData)
Edit: just be careful logging sensitive customer information.

Wojtek_B
- 4,245
- 1
- 7
- 21