Closed thadclay closed 8 years ago
Within the handler, you can call request.log
(see doc here)
Or do you want a more automated way to do this ?
@vdeturckheim Thanks for the link to the docs. Ideally I would like a more automated way of doing it. I was trying to avoid doing it in each handler.
The path, query parameters, and request body are available. See [https://github.com/hapijs/good/blob/master/lib/utils.js#L69-L70] and [https://github.com/hapijs/good/blob/master/lib/utils.js#L88-L90].
As far as the user credentials... that us unlikely unless they are somewhere in the query parameters or request body. What kind of auth are you using?
I'm using hapi-auth-cookie for authentication.
So that stuff is in request.auth.credentials
and not exposed in any event payloads generated by good.
I am reluctant to include it as it is secure information and once it leaves good
, I can't vouch for the security of anything else in the reporting pipeline. Plus then everything would have to strip that stuff off before logging for security reasons.
You may be able to do what you're looking for by adding "onPostAuth" or "onPreResponse" to the good extensions
option. That might have what you're looking for since they expose the entire request
object.
Great. Thanks for the suggestions. I will look into the good extensions.
@thadclay @vdeturckheim Did you guys figure out how to add data to the response event to be logged? I want to add userID information and can't seem to be able to have it passed through to the logs
This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.
I'm using Good 7, but I'm having a hard time figuring out how to pass additional data to an event. I want to add the request params and the users login but not sure how to do this. Here is my reporter setup.
Any help would be great.