Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Filter sensitive parameters from logs in clojure ring app

Tags:

clojure

ring

I'm using wrap-with-logger (from ring.middleware.logger) and wrap-params (from ring.middleware.params) middlewares in my application. Any simple way to filter sensitive parameters (password, credit card number etc.) from logs?

like image 409
Taha Husain Avatar asked Dec 22 '25 03:12

Taha Husain


1 Answers

You could also consider migrating to ring-logger which includes a feature to redact sensitive information:

By default, ring-logger will redact an authorization header or any param named password (at any nesting level). If you want ring-logger to redact other params you can configure the redact-keys option:

   (wrap-with-logger app {:redact-keys #{:senha :token})

Ring-logger will walk through the params and headers and redact any key whose name is found in that redact-keys set.

There's also ring-logger-onelog that should make it very easy to migrate from ring.middleware.logger to ring-logger

like image 195
nberger Avatar answered Dec 24 '25 09:12

nberger