riverrun / openmaize

No longer maintained - was an Authentication library for Plug-based applications in Elixir
Other
206 stars 30 forks source link

Add logging to login and email confirmation modules #84

Closed riverrun closed 7 years ago

riverrun commented 7 years ago

Add log messages to Login, OnetimePass, ConfirmEmail and ResetPassword modules.

Rationale

This is so that all activity related to these modules, particularly malicious or suspicious activity, is easier to monitor.

Outline

The need for logs is quite clear, but many of the details are up for discussion. The current plan is outlined below.

Use Logger.

Log the following cases:

and to include the following information in these messages:

mutablestate commented 7 years ago

@riverrun log messages should be friendly to devs visually debugging or grepping.

I've been using the key value logging convention logfmt and most of the popular services seem to support it. Codeship have a nice blog post about it a log format that's easy to read and write.

riverrun commented 7 years ago

I like the look of logfmt, and I think JSON would also be a viable alternative. Not only are they easy to read, but there are also many useful tools for both of them.

riverrun commented 7 years ago

In addition to the cases outlined above, there are now info logs for successful logins (both normal logins and with one-time passwords).

Also, the log level at which logging starts (just for Openmaize) can now be configured with the log_level value in the Config module.