RemoteIp2Logger
Description
Takes the overwritten Conn.remoteip and shoves it into the Logger metadata Depending on your setup you might need some Plugs _before this one. See: https://github.com/ajvondrak/remote_ip
Installation
Add to your mix.exs
def deps do
[
{:remote_ip_2_logger, "~> 0.1.0"}
]
endUsage
Add the RemoteIp2Logger plug to your app’s plug pipeline:
defmodule MyApp do
use Plug.Builder
plug RemoteIp2Logger
end
And then add the :ip to your Logger’s metadata line:
config :logger, :console,
format: "$time $metadata[$level] $message\n",
metadata: [:ip, :request_id, :module, :function, :line]