How do I enable POST request body in Google Cloud Platform Logs?

Viewed 1694

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?

Log Example

1 Answers

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.

Related