質問するログイン新規登録

回答編集履歴

1

Subject をログに記録する方法を追記

2017/05/29 13:32

投稿

CHERRY
CHERRY

スコア25234

answer CHANGED
@@ -9,4 +9,24 @@
9
9
  maillogconvert のドキュメントは、[http://www.awstats.org/docs/awstats_tools.html](http://www.awstats.org/docs/awstats_tools.html)
10
10
 
11
11
 
12
- [maillog-hashnize.pl](https://gist.github.com/xtetsuji/1446584)
12
+ [maillog-hashnize.pl](https://gist.github.com/xtetsuji/1446584)
13
+
14
+ ----
15
+ (コメントを受けての追記: Subject をログに記録する方法)
16
+
17
+ postfix で、Subjectヘッダをログに残すのであれば、「[header_checks](http://www.postfix-jp.info/trans-2.2/jhtml/header_checks.5.html)」を使うことぐらいでしょうか。
18
+
19
+ main.cf で、
20
+ ```
21
+ header_checks = regexp:/etc/postfix/header_checks
22
+ ```
23
+ としておいて、 /etc/postfix/header_checks に
24
+ ```
25
+ /^Subject: (.*)$/ warn
26
+ ```
27
+ と設定して、postfix を reload する。
28
+
29
+ その後に「mail -s "TEST Subject 1234" user2@example.jp」の様にメールを送信すると、以下のようにログに記録されると思います。なお、日本語は、エンコードされた状態で記録されます。
30
+ ```
31
+ May 29 22:00:00 localhost postfix/cleanup[13779]: 551508930943: warning: header Subject: TEST Subject 1234 from local; from=<user1@example.jp> to=<user2@example.jp>
32
+ ```