IP だけ記録して『これで何があっても最悪警察に通報すればなんとかなる』というとそうでは無い話。
結論:ポート番号も記録するのだ。nginx なら $remote_port
に値が入っている。
RFC 6302 : Logging Recommendations for Internet-Facing Servers
インターネット Facing なサーバーでどのようなログを取ることが推奨されるのかちゃんと書いてある資料
It is RECOMMENDED as best current practice that Internet-facing
servers logging incoming IP addresses from inbound IP traffic also
log:
o The source port number.
o A timestamp, RECOMMENDED in UTC, accurate to the second, from a
traceable time source (e.g., NTP [RFC5905]).
o The transport protocol (usually TCP or UDP) and destination port
number, when the server application is defined to use multiple
transports or multiple ports.
現在のベストプラクティスとして、インターネットに面したサーバーは、受信IPトラフィックから受信IPアドレスをログする際に、以下のログも取ることが推奨されます。
- source port number.
- timestamp.
- transport protocol (TCP / UDP 両方で受け付ける場合)