This is a direct and simple task. We really want to see the details of mail service by analysing the maillog daily. It gives a clear picture of what happened during the time period. The system ppl and marketing ppl may use it for customer clarifications.
We have enabled mail log statistics reporting tools in CentOS 6/7 servers which run Postfix as the mail agent.
Please follow the steps here:
1. Installing mail log analyser
yum install postfix-perl-scripts
This will install required script with perl modules. Just verify the proper work of it by running the command
perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog
which gives the details of the mail delivery of yesterday.
2. Enable automated reporting
You need to install 'nail' tool to send automated emails. Use this tool to send the output of the above command to required recipients.
e.g
/usr/bin/perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog | /usr/bin/nail -s "Mail status - company mail service `date --date="yesterday" +%d\ %B\ %Y`" -c systems@company.lk manager@company.lk
According to above example, a mail with yesterday mail status will be received by systems@company.lk and manager@company.lk
You can include the above command in a file located in where ever you prefer and change the mode to 770 for the script file enable executable mode.
e.g. chmod 770 /home/<your_home_directory/mail_stats
In root crontab, include an entry to execute the script file at a preferred time
crontab -e
E.g.
30 12 * * * /home/your_home_directory/scripts/mail_stats
We have enabled mail log statistics reporting tools in CentOS 6/7 servers which run Postfix as the mail agent.
Please follow the steps here:
1. Installing mail log analyser
yum install postfix-perl-scripts
This will install required script with perl modules. Just verify the proper work of it by running the command
perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog
which gives the details of the mail delivery of yesterday.
2. Enable automated reporting
You need to install 'nail' tool to send automated emails. Use this tool to send the output of the above command to required recipients.
e.g
/usr/bin/perl /usr/sbin/pflogsumm -d yesterday /var/log/maillog | /usr/bin/nail -s "Mail status - company mail service `date --date="yesterday" +%d\ %B\ %Y`" -c systems@company.lk manager@company.lk
According to above example, a mail with yesterday mail status will be received by systems@company.lk and manager@company.lk
You can include the above command in a file located in where ever you prefer and change the mode to 770 for the script file enable executable mode.
e.g. chmod 770 /home/<your_home_directory/mail_stats
In root crontab, include an entry to execute the script file at a preferred time
crontab -e
E.g.
30 12 * * * /home/your_home_directory/scripts/mail_stats
No comments:
Post a Comment