vectordotdev / timber-elixir

🌲 Great Elixir logging made easy
https://timber.io
Other
214 stars 29 forks source link

Add option to include parsed parameters in incoming HTTP requests #327

Closed binarylogic closed 5 years ago

binarylogic commented 5 years ago

The Timber Plug integration logs a http_request_received event that contains data about the incoming request. By default, it does not include the parsed parameters because this data can vary greatly in size. There are scenarios where this data can be very large, but in most cases, it's not that large and can be incredibly helpful to customers. I'd like to make a few changes to this:

  1. Send this data by default but only if it does not exceed a certain size. I'm unsure how we can do this efficiently.
  2. Make sure we do not include binary data from file uploads, etc.
  3. Add an option to explicitly enable or disable this feature. One of the options should represent the default in 1 above. For example, the values for this option could be true, false, or {:limit, byte_size}. Where the last option would only include the params if the byte size was <= the provided byte_size.

I'm open to other ideas here, but incoming request parameters are incredibly valuable and it's a common support question.

binarylogic commented 5 years ago

Closing this as this is already included in the controller_called event within the :timber_phoenix library. If users are using a framework, such as Phoenix, then parameters should be logged downstream when the request is processed. This is necessary since both the query string and body both need to be decoded and merged. Here's an example around how we do this in :timber_phoenix:

https://github.com/timberio/timber-elixir-phoenix/blob/802b8a44be4563f92970f5d3e69d0ac2ba168686/lib/timber_phoenix.ex#L275