sentry v1.1.0 Sentry.Plug
Provides basic funcitonality to handle Plug.ErrorHandler
Usage
Add the following to your router.ex:
use Plug.ErrorLogger
use Sentry.Plug
Sending Post Body Params
In order to send post body parameters you need to first scrub them of sensitive information. To
do so we ask you to pass a scrubber
key which accepts a Plug.Conn
and returns a map with keys
to send.
def scrub_params(conn) do
conn.params # Make sure the params have been fetched.
|> Map.to_list
|> Enum.filter(fn ({key, val}) ->
key in ~w(password passwd secret credit_card) ||
Regex.match?(~r/^(?:[ -]*?){13,16}$r/, val) # Matches Credit Cards
end)
|> Enum.into(%{})
end
Then pass it into Sentry.Plug
use Sentry.Plug, scrubber: &scrub_params/1
You can also pass it in as a {module, fun}
like so
use Sentry.Plug, scrubber: {MyModule, :scrub_params}
Please Note: If your are sending large files you will want to scrub them out.
Headers Scrubber
By default we will scrub Authorization and Authentication headers from all requests before sending them.