10

I have a server running over Google App Engine.

I am viewing my server's request-log via the console.

They are located under Google Cloud Platform --> Stackdriver Logging --> Logs.

I would like to view the arguments of a POST-Request.


With a GET-Request it is easy, as they are visible in the title of the entry.

They are also viable in the body of the entry, under protoPayload --> resource.

With a POST-Request, however, they are nowhere to be found.

Here are my options:

  • metadata
  • protoPayload
  • insertId
  • log
  • httpRequest
  • operation

None of these options seem to contain the arguments of the request.

From this answer, I understand that they should be within the request-body.

How can I find them within GAE logs?

Community
  • 1
  • 1
barak manos
  • 27,530
  • 9
  • 49
  • 106
  • 5
    I don't believe POST parameters are automatically displayed in logs due to security reasons. You don't want username/passwords that users may post on a site available in log files. You can explicitly output request params to logs from app engine code using logger.info in your code. – Jeff Deskins Jun 27 '16 at 13:51
  • @JeffDeskins: OK, so that would be considered as **application-logs**, not request-logs, right? – barak manos Jun 27 '16 at 13:52
  • @barakmanos, the two logs are one and the same. Using `'logging.info` will add additional information to the Stackdriver logs that you are looking at. – gaefan Jun 27 '16 at 14:12
  • 1
    @Kekito: As far as I understand, the request-log comes automatically (i.e., generated for every request that the server receives), and the application-log is (indeed) generated from my `logging` operations. So these logs are different to my understanding. Is that correct? And will I have to do `logging` in order to get the arguments of any POST-Request? Thanks. – barak manos Jun 27 '16 at 14:15
  • @barakmanos, no that is incorrect. A `logging.info()` shows up in the Stackdriver request logs and that is the only way to see POST arguments. Just try it! – gaefan Jun 27 '16 at 22:36
  • @Kekito: I have, and it does show up (with an `i` left to it). Was hoping that there could be a way without `logging`. Thanks :) – barak manos Jun 28 '16 at 06:58

1 Answers1

4

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.

robert king
  • 14,265
  • 8
  • 84
  • 107