Bug 1261858

Summary: logrotate 'ganesha-gfapi.log'
Product: [Red Hat Storage] Red Hat Gluster Storage Reporter: Soumya Koduri <skoduri>
Component: nfs-ganeshaAssignee: Jiffin <jthottan>
Status: CLOSED ERRATA QA Contact: Shashank Raj <sraj>
Severity: low Docs Contact:
Priority: unspecified    
Version: rhgs-3.1CC: akhakhar, divya, jthottan, kkeithle, mmalhotr, mzywusko, ndevos, nlevinki, rcyriac, rhinduja, sashinde
Target Milestone: ---Keywords: ZStream
Target Release: RHGS 3.1.3   
Hardware: All   
OS: All   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Previously, the log rotate configuration was no defined for ganesha-gfapi.log file. As a consequence, the ganesha-gfapi.log file was not log rotated and consumed lots of space. With this fix, appropriate configuration file was created and now the ganesha-gfapi.log file is rotated properly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-23 05:33:04 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1299184, 1308859    

Description Soumya Koduri 2015-09-10 10:28:16 UTC
Description of problem:

The ganesha-gfapi.log generated by nfs-ganesha service could grow to a very large size. It may be better to rotate this log file.

Maybe while packaging downstream rpms, we could edit "src/config_samples/logrotate_ganesha" and add an entry for '/var/log/ganesha-gfapi.log' as well.

Comment 2 Niels de Vos 2015-09-10 10:39:45 UTC
This should not only be done downstream, the upstream FSAL_GLUSTER also writes to /var/log/ganesha-gfapi.log by default.

Comment 3 Soumya Koduri 2015-09-10 10:44:04 UTC
That's right. I am not sure how we can include FSAL_GLUSTER specific log changes without editing "src/nfs-ganesha.spec-in.cmake" or "src/config_samples/logrotate_ganesha" and if its acceptable upstream.

Comment 4 Jiffin 2016-02-16 10:12:04 UTC
*** Bug 1308859 has been marked as a duplicate of this bug. ***

Comment 6 Niels de Vos 2016-03-29 13:11:31 UTC
(In reply to Soumya Koduri from comment #3)
> That's right. I am not sure how we can include FSAL_GLUSTER specific log
> changes without editing "src/nfs-ganesha.spec-in.cmake" or
> "src/config_samples/logrotate_ganesha" and if its acceptable upstream.

I suggest that we add a new configuration file for this in upstream, something like src/config_samples/logrotate_fsal_gluster:

  /var/log/ganesha-gfapi.log {
      copytruncate
      dateext
      compress
  }

This file can then be installed only when FSAL_GLUSTER is enabled, and included in the nfs-ganesha-gluster sub-package.

Comment 7 Jiffin 2016-03-30 06:42:48 UTC
Patch posted in upstream https://review.gerrithub.io/#/c/270854/

Comment 8 Kaleb KEITHLEY 2016-04-13 14:26:51 UTC
fixed in nfs-ganesha-2.3.1-3.el7rhgs and nfs-ganesha-2.3.1-3.el6rhs

Comment 9 Shashank Raj 2016-04-14 09:03:19 UTC
Verified this bug on RHEL 7 platfrom and it works fine as below:

[root@dhcp37-180 ~]# ls -ltr /etc/logrotate.d/ | grep ganesha
-rw-r--r--. 1 root root   73 Apr 13 19:37 ganesha-gfapi
-rw-r--r--. 1 root root   67 Apr 13 19:37 ganesha

[root@dhcp37-180 ~]# ls -ltr /var/log/ | grep ganesha
-rw-r--r--. 1 root      root           3035 Apr 12 04:20 ganesha.log-20160412.gz
-rw-------. 1 root      root     4615688831 Apr 14 00:47 ganesha-gfapi.log
-rw-r--r--. 1 root      root          33139 Apr 14 00:47 ganesha.log

[root@dhcp37-180 log]# logrotate -fv /etc/logrotate.d/ganesha-gfapi 
reading config file /etc/logrotate.d/ganesha-gfapi

Handling 1 logs

rotating pattern: /var/log/ganesha-gfapi.log  forced from command line (no old logs will be kept)
empty log files are rotated, old logs are removed
considering log /var/log/ganesha-gfapi.log
  log needs rotating
rotating log /var/log/ganesha-gfapi.log, log->rotateCount is 0
dateext suffix '-20160414'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
copying /var/log/ganesha-gfapi.log to /var/log/ganesha-gfapi.log-20160414
set default create context
truncating /var/log/ganesha-gfapi.log
compressing log with: /bin/gzip
set default create context

[root@dhcp37-180 log]# ls -ltr /var/log/ | grep ganesha
-rw-r--r--. 1 root      root          3035 Apr 12 04:20 ganesha.log-20160412.gz
-rw-------. 1 root      root      61292239 Apr 14 00:47 ganesha-gfapi.log-20160414.gz
-rw-r--r--. 1 root      root         33139 Apr 14 00:47 ganesha.log
-rw-------. 1 root      root             0 Apr 14 02:16 ganesha-gfapi.log

On RHEL 6

Beacuse of the bug (https://bugzilla.redhat.com/show_bug.cgi?id=1327074), could not proceed with the verification on RHEL 6.

Once we get a new build with working fix, will verify this on RHEL 6 as well.

Comment 10 Shashank Raj 2016-04-22 12:00:31 UTC
Verified this bug on RHEL 6 platform with latest glusterfs and ganesha build:

[root@dhcp42-121 ~]# rpm -qa|grep glusterfs
glusterfs-api-3.7.9-2.el6rhs.x86_64
glusterfs-geo-replication-3.7.9-2.el6rhs.x86_64
glusterfs-libs-3.7.9-2.el6rhs.x86_64
glusterfs-client-xlators-3.7.9-2.el6rhs.x86_64
glusterfs-fuse-3.7.9-2.el6rhs.x86_64
glusterfs-server-3.7.9-2.el6rhs.x86_64
glusterfs-ganesha-3.7.9-2.el6rhs.x86_64
glusterfs-3.7.9-2.el6rhs.x86_64
glusterfs-cli-3.7.9-2.el6rhs.x86_64

[root@dhcp42-121 ~]# rpm -qa|grep ganesha
nfs-ganesha-gluster-2.3.1-4.el6rhs.x86_64
glusterfs-ganesha-3.7.9-2.el6rhs.x86_64
nfs-ganesha-2.3.1-4.el6rhs.x86_64

Steps followed are as below:

[root@dhcp42-121 bin]# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 6.8 (Santiago)

[root@dhcp42-121 bin]# ls -ltr /etc/logrotate.d/ | grep ganesha
-rw-r--r--. 1 root root   73 Apr 21 08:00 ganesha-gfapi
-rw-r--r--. 1 root root   67 Apr 21 08:00 ganesha

[root@dhcp42-121 bin]# ls -ltr /var/log/ | grep ganesha
-rw-r--r--. 1 root      root       4390 Apr 22 22:51 ganesha.log
-rw-------. 1 root      root      14840 Apr 22 22:51 ganesha-gfapi.log

[root@dhcp42-121 bin]# logrotate -fv /etc/logrotate.d/ganesha-gfapi
reading config file /etc/logrotate.d/ganesha-gfapi
reading config info for /var/log/ganesha-gfapi.log 

Handling 1 logs

rotating pattern: /var/log/ganesha-gfapi.log  forced from command line (no old logs will be kept)
empty log files are rotated, old logs are removed
considering log /var/log/ganesha-gfapi.log
  log needs rotating
rotating log /var/log/ganesha-gfapi.log, log->rotateCount is 0
dateext suffix '-20160422'
glob pattern '-[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]'
glob finding old rotated logs failed
copying /var/log/ganesha-gfapi.log to /var/log/ganesha-gfapi.log-20160422
set default create context
truncating /var/log/ganesha-gfapi.log
compressing log with: /bin/gzip
set default create context
[root@dhcp42-121 bin]# ls -ltr /var/log/ | grep ganesha
-rw-r--r--. 1 root      root       4390 Apr 22 22:51 ganesha.log
-rw-------. 1 root      root          0 Apr 22 22:52 ganesha-gfapi.log
-rw-------. 1 root      root       1674 Apr 22 22:52 ganesha-gfapi.log-20160422.gz

Its working as expected. Hence based on the above observation, marking this bug as Verified.

Comment 11 Divya 2016-06-10 06:03:30 UTC
Jiffin,

Could you review and sign-off the edited doc text.

Comment 12 Jiffin 2016-06-15 09:24:36 UTC
Doc test looks good to me

Comment 14 errata-xmlrpc 2016-06-23 05:33:04 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHEA-2016:1247