Postfix
Troubleshooting
Metrics
- All: Mail - Postfix servers
- Outbound: Mail - Postfix servers
- Inbound: Mail - Postfix servers
Logs
- All: Postfix
- Outbound: Postfix mx-out
- Inbound: Postfix mx-in
Queues
- active: in memory queue, messages that are ready to be delivered
- incoming: disk queue of received messages
- deferred: messages that failed delivery, they are retried with exponential backoff
Inbound mail is mostly redirected to our Gsuite instance and VRTS, so you should expect fewer that 20 messages in the deferred queue. Outbound mail primarily consists of email notifications from our projects to users. The deferred queue for outbound will be around 1000 messages per server as external mail servers are unreachable for a variety of reasons. Under normal load you should expect the active and incoming queues to be mostly empty, with brief spikes as mail is received and then immediately delivered. To obtain a quick overview of the active and incoming queues use the qshape tool:
$ sudo qshape T 5 10 20 40 80 160 320 640 1280 1280+ TOTAL 0 0 0 0 0 0 0 0 0 0 0
The value in the T
column is the total mail in the incoming and active queues. Each following numbered column displays the count of mail that is the corresponding number of minutes old.
Show queues
# View the incoming and active queues $ sudo qshape # View the deferred queue $ sudo qshape deferred # List all mail in all queues $ postqueue -p # Show queue count totals $ postqueue -j | jq -s 'group_by(.queue_name) | map({"queue": .[0].queue_name, "count": length})'
Flush the mail queue
$ postqueue -f
Deliver just one specific email from the queue
$ postqueue -i <QUEUE_ID>
Search for a specific email from a sender
$ postqueue -j | jq 'select(.sender == "wiki@wikimedia.org")'
Search for a specific email to a recipient
$ postqueue -j | jq 'select(.recipients[].address == "butter@example.com")'
Count number of emails to a specific recipient
$ postqueue -j | jq -s 'map(select(.recipients[].address == "butter@example.com")) | length'
Remove emails to a specific recipient
$ postqueue -j | jq -r ' select(.recipients[0].address == "user@example.com") | select(.recipients[1].address == null) | .queue_id' | sudo postsuper -d -
View a message in the queue
$ postcat -q <QUEUE_ID>
Configuration
Postfix has two main config files:
main.cf
: Specifies config options for the postfix daemonsmaster.cf
: Specifies the daemons postfix should run