Tulisan ini adalah lanjutan dari tulisan saya dengan judul Setup SMTP Haraka di Ubuntu 18.04. Saat pertama kali menggunakan Haraka, teman-teman pasti akan kebingungan untuk memantau aktivitas yang dilakukan oleh Haraka. Mulai dari berhasil kirim email, gagal kirim email, plugin yang aktif, bahkan error yang ada.
Hal ini sangat wajar, karena secara default Haraka tidak menulis output proses yang dilakukan ke dalam sebuah file, tidak ada file.log yang mencatat semua aktivitas Haraka. Sistem Haraka mungkin berajalan sebagaimana biasa, bisa kirim email dan lain-lain, tetapi akan sangat mengganggu jika teman-teman sebagai sistem administrator tidak mengetahui apa yang terjadi dengan sistem tersebut. Pastinya akan sangat sulit jika ada troubleshooting yang perlu dilakukan.
Maka dari itu, saya akan menunjukkan bagaimana cara generate log Haraka dan mengarahkan semua output Haraka ke file.log.
Aktivasi Log Haraka
- Pastikan teman-teman sudah membaca dan melakukan langkah-langkah pada tulisan Setup SMTP Haraka di Ubuntu 18.04
- Tambahkan 3 baris teks pada file /etc/systemd/system/haraka.service dengan perintah berikut
# sed '/^PrivateTmp=true/a StandardOutput=syslog\nStandardError=syslog\nSyslogIdentifier=haraka' -i /etc/systemd/system/haraka.service
- Membuat file /etc/rsyslog.d/haraka.conf dengan isi teks sebagai berikut
if $programname == 'haraka' then /var/log/haraka.log & stop
- Membuat file dan memberikan permission file log
# touch /var/log/haraka.log # chown syslog:adm /var/log/haraka.log
- Restart service daemon, rsyslog dan Haraka
# systemctl daemon-reload # systemctl restart rsyslog # systemctl restart haraka
- Selanjutnya, teman-teman bisa memantau semua aktifitas Haraka dengan cara inspect /var/log/haraka.log dengan perintah cat (cat /var/log/haraka.log) ataupun memantau file log tersebut secara berkelanjutan dengan perintah tail (tail -f /var/log/haraka.log). DIbawah ini merupakan isi dari file log tersebut
Jan 20 09:25:45 haraka haraka[2045]: loaded TLD files: 1=1528 2=8564 3=2448 Jan 20 09:25:45 haraka haraka[2045]: loaded 8787 Public Suffixes Jan 20 09:25:46 haraka haraka[2045]: loglevel: INFO Jan 20 09:25:46 haraka haraka[2045]: log format: DEFAULT Jan 20 09:25:46 haraka haraka[2045]: [WARN] [-] [core] smtp.ini.nodes unset, using 1, see https://github.com/haraka/Haraka/wiki/Performance-Tuning Jan 20 09:25:46 haraka haraka[2045]: Starting up Haraka version 2.8.25 Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugins Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: dnsbl Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: helo.checks Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: mail_from.is_resolvable Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: rcpt_to.in_host_list Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: data.headers Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: queue/smtp_forward Jan 20 09:25:46 haraka haraka[2045]: [NOTICE] [-] [queue/smtp_forward] outbound enabled, will default to disabled in Haraka v3 (see #1472) Jan 20 09:25:46 haraka haraka[2045]: [NOTICE] [-] [core] the plugin max_unrecognized_commands has been replaced by 'limit'. Please update config/plugins Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: limit Jan 20 09:25:46 haraka haraka[2045]: [ERROR] [-] [limit] Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [limit] Disconnected from redis://127.0.0.1:6379/4 Jan 20 09:25:46 haraka haraka[2045]: [WARN] [-] [dnsbl] disabling zone 'zen.spamhaus.org': 36.86.63.182 Jan 20 09:25:46 haraka haraka[2045]: [NOTICE] [-] [core] worker started worker=1 pid=2056 Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [dnsbl] re-enabling zone zen.spamhaus.org Jan 20 09:25:46 haraka haraka[2045]: loaded TLD files: 1=1528 2=8564 3=2448 Jan 20 09:25:46 haraka haraka[2045]: loaded 8787 Public Suffixes Jan 20 09:25:46 haraka haraka[2045]: loglevel: INFO Jan 20 09:25:46 haraka haraka[2045]: log format: DEFAULT Jan 20 09:25:46 haraka haraka[2045]: [WARN] [-] [core] smtp.ini.nodes unset, using 1, see https://github.com/haraka/Haraka/wiki/Performance-Tuning Jan 20 09:25:46 haraka haraka[2045]: Starting up Haraka version 2.8.25 Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugins Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: dnsbl Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: helo.checks Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: mail_from.is_resolvable Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: rcpt_to.in_host_list Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: data.headers Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: queue/smtp_forward Jan 20 09:25:46 haraka haraka[2045]: [NOTICE] [-] [queue/smtp_forward] outbound enabled, will default to disabled in Haraka v3 (see #1472) Jan 20 09:25:46 haraka haraka[2045]: [NOTICE] [-] [core] the plugin max_unrecognized_commands has been replaced by 'limit'. Please update config/plugins Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [core] Loading plugin: limit Jan 20 09:25:46 haraka haraka[2045]: [NOTICE] [-] [core] Listening on :::25 Jan 20 09:25:46 haraka haraka[2045]: [NOTICE] [-] [core] worker 1 listening on ::0:25 Jan 20 09:25:46 haraka haraka[2045]: [WARN] [-] [dnsbl] disabling zone 'zen.spamhaus.org': 36.86.63.182 Jan 20 09:25:46 haraka haraka[2045]: [ERROR] [-] [limit] Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [limit] Disconnected from redis://127.0.0.1:6379/4 Jan 20 09:25:46 haraka haraka[2045]: [INFO] [-] [dnsbl] re-enabling zone zen.spamhaus.org Jan 20 09:25:46 haraka haraka[2045]: [ERROR] [-] [limit] Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 Jan 20 09:25:48 haraka haraka[2045]: message repeated 7 times: [ [ERROR] [-] [limit] Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379] Jan 20 09:25:49 haraka haraka[2045]: [ERROR] [-] [limit] Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379 Jan 20 09:26:19 haraka haraka[2045]: message repeated 9 times: [ [ERROR] [-] [limit] Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379] Jan 20 09:26:19 haraka haraka[2045]: [NOTICE] [FEE6B927-B58E-45A7-85A1-ED36FEC6173C] [core] connect ip=127.0.0.1 port=46530 local_ip=:: local_port=25 Jan 20 09:26:21 haraka haraka[2045]: [INFO] [FEE6B927-B58E-45A7-85A1-ED36FEC6173C] [core] client [127.0.0.1] half closed connection Jan 20 09:26:21 haraka haraka[2045]: [NOTICE] [FEE6B927-B58E-45A7-85A1-ED36FEC6173C] [core] disconnect ip=127.0.0.1 rdns=Unknown helo="" relay=N early=N esmtp=N tls=N pipe=N errors=0 txns=0 rcpts=0/0/0 msgs=0/0/0 bytes=0 lr="" time=1.876 Jan 20 09:26:30 haraka haraka[2045]: [NOTICE] [-] [core] Shutting down