io_debug: Extra option for only logging on failure
- 主要言語
- Go
- スター
- 6.1k
- フォーク
- 327
- PR マージ指標
- 30日以内にマージされた PR はありません
説明
# Use case
io_debug is currently [a boolean flag](https://maddy.email/reference/endpoints/smtp/#io_debug-boolean).
Turning it on to log everything when debugging either Maddy's sources or on bringing up a new server makes sense. However, it would also be useful for longer-term debugging of more complex issues with server setup if it could log the entire communication only when an error has occurred. Thus successful connections do not need the extra info, whilst problem communication can capture this for days or weeks without needing to generate overly verbose logs.
There is also the possibility that extended logging on failure/rejections/etc. could be valuable for feeding into systems like fail2ban or CrowdSec for blacklisting spam and attackers, enabling such systems to differentiate better between malicious connections and innnocent failures.
# Your idea for a solution
How your solution would work in general?
I haven;t yet looked to see how difficult this would be in terms of implementation. But for the interface, simply adding a third option to the config directive - "on", "off", and e.g. "on_failure" seems suitable to me.
- [x] I'm willing to help with the implementation
* I think I can implement but would appreciate guidance and a review of changes to ensure it's implemented in the required places.
コントリビューションガイド
調査の方向性
まず、既存の io_debug 設定処理と SMTP 通信のログ記録経路を追跡してください。この issue にはファイルまたはテストのエントリーポイントがありません。成功とエラーの結果がどのように識別されるかを確認し、新しいオプションが失敗したインタラクションに対してのみ通信全体をログに記録するよう、off、on、on_failure の動作を対象とするテストを定義してください。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- go
- 領域
- backend, observability
- issue の種類
- 機能追加
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 25/100