diff options
author | Dennis Eriksen <d@ennis.no> | 2019-11-12 15:07:12 +0100 |
---|---|---|
committer | Dennis Eriksen <d@ennis.no> | 2019-11-12 15:07:12 +0100 |
commit | 497b16d311de30a9c6c4fa6892e3827b7f088e9d (patch) | |
tree | ebbd1131d1ad4d4772134400183bfc778c6be999 /README.md | |
parent | Added a function and removing reduntant lines. Cleaned up a bit. (diff) | |
download | eximstats-cron-497b16d311de30a9c6c4fa6892e3827b7f088e9d.tar.gz |
Diffstat (limited to 'README.md')
-rw-r--r-- | README.md | 31 |
1 files changed, 31 insertions, 0 deletions
@@ -2,3 +2,34 @@ eximstats-cron ============== `eximstats-cron` is a cronjob that runs `eximstats` on your machine. + +`eximstats` is installed with `exim4-base` on Debian/Ubuntu, so ut probably +already exists on your system. Why not use it to generate mailstatistics? :) + +`eximstats-cron` will use `eximstats` to generate daily, weekly, monthly and +yearly statistics in HTML form which you can easily serve using some webserver. + +## Logging in exim4 + +For this script to work, you need to generate daily exim-logs. The following +option will make Exim output logs to `/var/log/exim4/mainlog-YYYYMMDD`. +``` +log_file_path = syslog : /var/log/exim4/%slog-%D +``` +It needs to go into your exim4-config. + +Since I like to find my latest logfiles in a location that doesn't change +every day, I have the following two lines in cron to make sure there is always a +symlink pointing to the latest logfile. +``` +# This just symlinks latest logfiles +# The backslashes before % in `date` escapes %, because they're a special cron-character. +00 00 * * * Debian-exim rm -f /var/log/exim4/mainlog-latest && ln -s /var/log/exim4/mainlog-$(date +\%Y\%m\%d) /var/log/exim4/mainlog-latest && touch /var/log/exim4/mainlog-$(date +\%Y\%m\%d) && chmod 640 /var/log/exim4/mainlog-$(date +\%Y\%m\%d) +00 00 * * * Debian-exim rm -f /var/log/exim4/rejectlog-latest && ln -s /var/log/exim4/rejectlog-$(date +\%Y\%m\%d) /var/log/exim4/rejectlog-latest && touch /var/log/exim4/rejectlog-$(date +\%Y\%m\%d) && chmod 640 /var/log/exim4/rejectlog-$(date +\%Y\%m\%d) +``` + +## Setting up eximstats-cron + +Just clone this repo somewhere, and symlink `eximstats-cron` into +`/etc/cron.daily/`. Easy-peasy. The logs will start to appear in +`/var/log/eximstats` the very next day! |