Logger (ZCS 5.0.x and earlier)
Although the logger is not essential for Zimbra to operate, this article will describe setup, configuration, and troubleshooting of the logger service.
- 1 Setup and Configuration
- 2 Troubleshooting
Setup and Configuration
If the logger service is installed during ZCS installation, zmsetup.pl runs zmloggerinit, which A) creates the zimbra_logger database and the tables shown in the output below, and B) generates the zimbra and root mysql user passwords, and stores them in zmlocalconfig.
In order to allow the log host to accept log messages from the other nodes, add the "-r" option to the SYSLOGD_OPTIONS line in /etc/sysconfig/syslog; for example:
SYSLOGD_OPTIONS="-r -m 0"
Accessing the logger MySQL database manually
$ logmysql zimbra_logger
mysql> show tables; +-------------------------+ | Tables_in_zimbra_logger | +-------------------------+ | amavis | | amavis_aggregate | | config | | disk_aggregate | | disk_status | | mta | | mta_aggregate | | processing_history | | raw_logs | | service_status | +-------------------------+
Overview of logger pipeline
1. The mta components (postfix, amavis) and system status scripts (zmstatuslog, zmdisklog, zmqueuelog) log to /var/log/zimbra.log.
2. The logswatch script monitors /var/log/zimbra.log and sends new lines to the zmlogger script.
3. The zmlogger script inserts the log lines into the raw_logs table, and updates the service_status table, in the zimbra_logger database.
4. The zmlogprocess script breaks down the lines from the raw_logs table and inserts the data into the mta, mta_aggregate, amavis, amavis_aggregate, disk_status, disk_aggregate, and processing_history tables of the zimbra_logger db.
How to determine why logger isn't working
Why does the logger service stop? The two main causes are log rotation and a bug in zmlogswatchctl before ZCS 4.5.
Check "zmcontrol status"
1. If "logmysql.server is not running", verify whether A) the file /opt/zimbra/logger/db/mysql.pid exists, and B) there is an /opt/zimbra/logger/mysql/libexec/mysqld process.
cat /opt/zimbra/logger/db/mysql.pid ps aux | grep logger/mysql
Under normal operation, the id of this mysqld process will be in the mysql.pid file.
2. If "zmlogswatchctl is not running", verify whether A) the file /opt/zimbra/log/logswatch.pid exists, and B) there is a single /opt/zimbra/libexec/logswatch process.
cat /opt/zimbra/log/logswatch.pid ps aux | grep logswatch
3. If "logger Running", verify that the logger database is accessible and that there are not multiple logswatch scripts running (see #2).
logmysqladmin status ps aux | grep logswatch
Check the MTA log
1. Is there MTA activity?
grep postfix /var/log/zimbra.log grep amavis /var/log/zimbra.log
2. Is there ZCS system information?
grep STATUS /var/log/zimbra.log grep DISK /var/log/zimbra.log grep QUEUE /var/log/zimbra.log
Check the logger database
1. Is data making it to the service_status and raw_logs tables (choose the current date)?
logmysql zimbra_logger select * from service_status; select * from raw_logs where log_date > '2007-03-15';
What queries the logger database
1. The zmdailyreport script processes data from the mta and amavis tables, and emails the results to root, which is normally an alias to the original zimbra admin account.
[zimbra@mail ~]$ crontab -l | grep zmdailyreport 10 1 * * * /opt/zimbra/libexec/zmdailyreport | /opt/zimbra/postfix/sbin/sendmail root
[zimbra@mail ~]$ zmprov getAccount admin | grep Alias zimbraMailAlias: email@example.com zimbraMailAlias: firstname.lastname@example.org
2. The zmmsgtrace tool queries the mta and amavis tables and outputs basic info about matching messages.
3. The zmgengraphs script queries the disk_aggregate, mta_aggregate, and amavis_aggregate tables and creates images that will be displayed in the admin console.