darold / sendmailanalyzer

Sendmail log Analyzer is a tool to monitor sendmail usage and generate HTML and graph reports. It reports all you ever wanted to know about email trafic on your network. You can also use it in ISP environment with per domain and per mailbox report.
http://sendmailanalyzer.darold.net/
GNU General Public License v3.0
76 stars 13 forks source link

Hourly Logs are not updating #46

Closed shawnmyers closed 6 years ago

shawnmyers commented 7 years ago

Hi Darolnd,

I have installed SendmailAnalyzer on Centos7. But Hourly logs are not updating. What could be the issue?

Its showing no record for this period

darold commented 7 years ago

Hi,

Sorry for the response delay. I think the reason is that maillog on CentOs 7 goes through journalctl. What is you sendmailanalyzer command? Are you using the --journalctl option to replace logfile?

Regards,

shawnmyers commented 7 years ago

Hi,

My sendmailanalyzer command is below in startup script. Moreover, stats don't update in real time, they update after one day

ExecStart=/usr/local/sendmailanalyzer/sendmailanalyzer -f

darold commented 7 years ago

Does the sendmailanalyzer daemon is running during the day? What is the result of command ps auwx | grep sendmailanalyzer | grep -v grep ?

shawnmyers commented 7 years ago

Below is Output of command

root 12794 0.1 0.7 162616 27964 ? Ss 04:04 0:08 sendmailanalyzer root 26426 0.0 0.2 141276 8940 ? Ss Mar10 0:52 sendmailanalyzer

Moreover, below is status of Systemctl command

systemctl status sendmailanalyzer ● sendmailanalyzer.service - SendmailAnalyzer Loaded: loaded (/usr/lib/systemd/system/sendmailanalyzer.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2017-03-16 04:04:01 EDT; 1h 31min ago Process: 12789 ExecStop=/bin/kill -TERM sendmailanalyzer (code=exited, status=1/FAILURE) Process: 12792 ExecStart=/usr/local/sendmailanalyzer/sendmailanalyzer -f (code=exited, status=0/SUCCESS) Main PID: 12794 (sendmailanalyze) CGroup: /system.slice/sendmailanalyzer.service ├─12794 sendmailanalyzer └─12796 /bin/tail -n 0 -F /var/log/maillog

Mar 16 04:04:01 systemd[1]: sendmailanalyzer.service: main process exited, code=exited, status=1/FAILURE Mar 16 04:04:01 systemd[1]: Unit sendmailanalyzer.service entered failed state. Mar 16 04:04:01 systemd[1]: sendmailanalyzer.service failed. Mar 16 04:04:01 systemd[1]: Starting SendmailAnalyzer... Mar 16 04:04:01 systemd[1]: Started SendmailAnalyzer.

darold commented 7 years ago

Hum, you have two sendmailanalyzer running, this is not normal unless you have two different installation and logfile to process. If this is not the case, please kill both processes and restart sendmailanalyzer using systemctl start sendmailanalyzer then verify that you just have one process running.

shawnmyers commented 7 years ago

Yes, two processes are running. Check details below

root 26426 0.0 0.2 141276 8940 ? Ss Mar10 0:52 sendmailanalyzer

The above started on March 10 and still running.

Other below process started today at 4AM using cron job from following cron task

Process: root 12794 0.1 0.7 162616 27964 ? Ss 04:04 0:08 sendmailanalyzer Cron Task:

# Daemon restart after maillog logrotate (cron jobs at 4:04 every day)
# Feel free to replace this line by an entry in /etc/logrotate.d/syslog
4 4 * * *     root  /bin/systemctl restart sendmailanalyzer > /dev/null 2>&1

Cron Task File is /etc/cron.d/sendmailanalyzer

Should I disable this cron?

darold commented 7 years ago

Yes you have to remove it and use logrotate to restart sendmailanalyzer. In /etc/logrotate.d/syslog add this to the postrotate section:

/usr/bin/systemctl restart sendmailanalyzer.service > /dev/null 2>&1 || true
shawnmyers commented 7 years ago

Thanx. One more question, How much interval logs shows on sendmailanalyzer?

darold commented 7 years ago

By default sendmailanalyzer refresh the data files each five seconds so obviously it only depend of the number of entries in your log and at which frequency you are refreshing the report in the browser. There is no automatic refresh in the CGI.

But if you need speed in the CGI interface you have to run sa_cache frequently to constantly update the statistics. I recommend you to set the following in your crontab:

# On huge MTA you may want to have five minutes caching
*/5 * * * * /usr/local/sendmailanalyzer/sa_cache -a > /dev/null 2>&1

So in this case you will have a pre-calculated interval of five minutes.

shawnmyers commented 7 years ago

Yeah It has already been set.

Thanks darold