Logger and SNMP suddenly has stops running

Discuss your pilot or production implementation with other Zimbra admins or our engineers.
Post Reply
alexandruvoicu
Posts: 2
Joined: Wed Nov 23, 2022 12:38 am
Location: Bucharest, ROmania
ZCS/ZD Version: Release 8.8.15_GA_3953.RHEL8_64_202

Logger and SNMP suddenly has stops running

Post by alexandruvoicu »

Hi all

I'm confronting with the following issue... suddenly logger has stopped to work. Same and SNMP. When i look into zmlogswatch.out i discovered this message:
Error opening /var/log/zimbra-stats.log: Permission denied at /opt/zimbra/data/tmp/.swatchdog_script.2882929 line 92.. In /var/log both zimbra logs are 0 bytes lenght.

Also looking into /opt/zimbra/data/tmp/.swatchdog_script.2882929 line 92, is the line responsible to open /var/log/zimbra-stats.log and write inside that file, are the following:

use File::Tail;
my $Filename = '/var/log/zimbra-stats.log';
my $File = File::Tail->new(name=>$Filename, tail=>1, maxinterval=>0.5, interval=>0.5);

My zimbra version: Release 8.8.15_GA_3953.RHEL8_64_20200629025823 RHEL8_64 FOSS edition, Patch 8.8.15_P35.

How can i solve this issue? A reinstallation could solve this problem, but i''m not sure that in future will be repeated again... Maybe a bug?

Many thanks for help
alexandruvoicu
Posts: 2
Joined: Wed Nov 23, 2022 12:38 am
Location: Bucharest, ROmania
ZCS/ZD Version: Release 8.8.15_GA_3953.RHEL8_64_202

Re: Logger and SNMP suddenly has stops running

Post by alexandruvoicu »

Well after i digg almost two days on the forum.... i realized that the real problem is with the file permissions and the permissions was modified meanwhile by an unknown source.

zmlogswatch.out -> Error opening /var/log/zimbra-stats.log: Permission denied at /opt/zimbra/data/tmp/.swatchdog_script.2882929 line 92

I added user zimbra in the root group and ... everything has started normal.
This is definitely a BUG.... there are no reasons that zimbra-stats.log permissions to be modified overnight. I'm sure that many other users has experienced this issue,.

In fact what permissions are established by default for the following two files: zimbra.log and zimbra-stats.log?
And why if i added zimbra user to the root group is logger and SNMP is working again?
User avatar
JDunphy
Outstanding Member
Outstanding Member
Posts: 889
Joined: Fri Sep 12, 2014 11:18 pm
Location: Victoria, BC
ZCS/ZD Version: 9.0.0_P39 NETWORK Edition

Re: Logger and SNMP suddenly has stops running

Post by JDunphy »

Different results here for RHEL8 and P35 then you are reporting.

Code: Select all

# su - zimbra
% zmcontrol -v
Release 8.8.15_GA_3953.RHEL8_64_20200629025823 RHEL8_64 FOSS edition, Patch 8.8.15_P35.
Should be something like this. Syslog (rsyslogd) writes to /var/log/zimbra-stats.log and swatch (perl program) reads the file looking for line like STATUS, etc. logrotate handles rotation and creation of the files and syslog generally will not log to a file unless it exists first. There should be a zimbra logrotate config file:

Code: Select all

% ls -l /etc/logrotate.d/zimbra 
-rw-r--r-- 1 root root 3336 Oct 15 08:51 /etc/logrotate.d/zimbra
%  head -24 /etc/logrotate.d/zimbra
/var/log/zimbra.log {
    daily
    missingok
    notifempty
    create 0644 zimbra zimbra
    postrotate
      kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
      su - zimbra -c "/opt/zimbra/bin/zmconfigdctl restart" > /dev/null 2>&1 || true
    endscript
    compress
}

/var/log/zimbra-stats.log {
    daily
    missingok
    notifempty
    create 0644 zimbra zimbra
    postrotate
      kill -HUP `cat /var/run/rsyslogd.pid 2> /dev/null` 2> /dev/null || true
      su - zimbra -c "/opt/zimbra/bin/zmconfigdctl restart" > /dev/null 2>&1 || true
    endscript
    rotate 0
}
Verify that logrotate has a zimbra conf file and the create lines shown above exist. Logrotate is kicked off by cron.daily. /etc/rsyslog.conf looks like this:

Code: Select all

% grep zimbra /etc/rsyslog.conf
local0.*                -/var/log/zimbra.log
local1.*                -/var/log/zimbra-stats.log
auth.*                  -/var/log/zimbra.log
mail.*                -/var/log/zimbra.log
and permissions and ownership should be:

Code: Select all

mail:~:44> ls -l /var/log/zimbra*.log
-rw-r--r-- 1 zimbra zimbra  1901468 Nov 25 15:18 /var/log/zimbra.log
-rw-r--r-- 1 zimbra zimbra 21730337 Nov 25 15:19 /var/log/zimbra-stats.log
mail:~:45> ps auxw |grep swatch
zimbra   2092777  0.0  0.1  62444 15832 ?        SNs  04:04   0:16 /opt/zimbra/common/bin/swatchdog --config-file=/opt/zimbra/conf/logswatchrc --use-cpan-file-tail --pid-file=/opt/zimbra/log/logswatch.pid --daemon --script-dir=/opt/zimbra/data/tmp --tail-file /var/log/zimbra-stats.log
zimbra   2092935  0.0  0.1  46704 13128 ?        SN   04:04   0:00 /usr/bin/perl /opt/zimbra/common/bin/swatchdog --config-file=/opt/zimbra/conf/swatchrc --use-cpan-file-tail --script-dir=/opt/zimbra/data/tmp --tail-file /var/log/zimbra.log
zimbra   2092947  0.0  0.4 112056 39344 ?        SN   04:04   0:21 /usr/bin/perl /opt/zimbra/data/tmp/.swatchdog_script.2092935
Find out why the user zimbra doesn't own /var/log/zimbra-stats.log and undo your changes to /etc/group

If the files are 0 bytes in size, then make sure (rsyslogd is running followed by cron). You can restart them vs rebooting.

HTH,

Jim
Post Reply