How to use the exigrep command to check mailserver logs on your VPS

If you’re experiencing issues with sending or receiving email via your HostPapa VPS server, the exigrep tool, available when using SSH and the command line, can be used to troubleshoot mailserver logs.

Log in to your server using SSH, then use the cd command to navigate to the directory in which your mailserver logs are stored.

cd /var/log

logs

Two logfiles are useful for troubleshooting mail issues.

  • exim_mainlog – tracks every mail transaction that your server handles.
  • exim_rejectlog – logs delivery rejections.

While the grep command is often used to identify lines in a log file that match a search string, the exigrep command actually works better with mail logs. A single mail transaction can span multiple lines in the log file, and not every line contains the search string being sought. exigrep finds the search string in transactions, then collates every log entry into separate, complete transactions.

The exigrep command requires a search string and a target file name:

exigrep “search_for_this” filename

Understanding exigrep search results

When parsing the output from exigrep searches, be sure to look out for the word “Completed” on the last line. This indicates that the email in question was delivered. If you don’t see “Completed”, it means an error occurred.

Each transaction will be listed with the following details:

  • Timestamp – the date and time that a specific step of the mail transaction occurred.
  • from and to –  the sender and receiver of the email.
  • Transaction ID – a unique identification string.

If you notice any problems or if you need any help, please open a new support ticket from your HostPapa Dashboard. More details on how to open a support ticket can be found here.

Was this article helpful?

[was-this-helpful]

Related Articles

Leave A Comment?