[Gluster-users] How to rotate logs on glusterfs 3.1.0

Craig Carl craig at gluster.com
Wed Nov 3 14:35:59 UTC 2010


Phil - 
Thank you very much for your contribution. I believe that 'gluster volume rotate <VOLNAME>' will rotate the logs on all of the servers and clients, but I have asked engineering for clarification. 
Your client script would almost certainly interrupt I/O, glusterfs doesn't respond well to HUP, let me get something back from engineering and I will get it out to the list and included in the next point release. 
The server script looks good, I would suggest a couple of changes while we get proper support added - 

1. Use the 'gluster log locate' command to find the logs instead of hard coding. 
2. Use 'which gluster' instead of hard coding. 

logrotate support should be included in Gluster, I have filed http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2053 to get it added. 




Thanks, 
Craig 

--> 
Craig Carl 



Gluster, Inc. 
Cell - (408) 829-9953 (California, USA) 
Gtalk - craig.carl at gmail.com 


From: "Phil Packer" <philp at layer3.co.uk> 
To: "Gluster General Discussion List" <gluster-users at gluster.org> 
Sent: Wednesday, November 3, 2010 4:52:57 AM 
Subject: Re: [Gluster-users] How to rotate logs on glusterfs 3.1.0 

Hi, thanks, Craig... 

I looked at that, and I realise that this will let me rotate the logs under /var/log/glusterd/bricks and that I can call that from logrotate if I want, but how should I rotate the logs from the glusterfs clients such as nfs.log? 

I presume something like this would work (I've not tested it) and if so, it might be a good idea to drop a script into the RPM to avoid other people struggling with it? 

---snip-- 
# Rotate client logs 
/var/log/glusterfs/*.log { 
sharedscripts 
missingok 
postrotate 
/usr/bin/killall -HUP glusterfs > /dev/null 2>&1 || true 
endscript 
} 

# Rotate server logs 
/var/log/glusterfs/bricks/*.log { 
sharedscripts 
missingok 
prerotate 
for i in `gluster volume info all | grep Volume | cut -f3 -d" "`; do 
/usr/bin/gluster volume rotate $i 
done 
endscript 
} 
---snip--- 



Thanks 

Phil 

ps I don't use nfs in this set up, how can I stop the glusterfs daemon providing nfs service? 

Thanks again 

P 


On 3 Nov 2010, at 10:22, Craig Carl wrote: 

> Phil - 
> Please check this page - http://www.gluster.com/community/documentation/index.php/Gluster_3.1:_Rotating_Logs 
> 
> 
> 
> Thanks, 
> Craig 
> 
> --> 
> Craig Carl 
> Gluster, Inc. 
> Cell - (408) 829-9953 (California, USA) 
> Gtalk - craig.carl at gmail.com 
> 
> 
> From: "Phil Packer" <philp at layer3.co.uk> 
> To: "Gluster General Discussion List" <gluster-users at gluster.org> 
> Sent: Wednesday, November 3, 2010 2:22:23 AM 
> Subject: [Gluster-users] How to rotate logs on glusterfs 3.1.0 
> 
> Hi, folks, 
> 
> Now the autofs issues have been sorted out (for which, thank you very much) I've finally upgraded my client's system to 3.1.0 but I now have some issues with logfiles. 
> 
> 
> Currently running on Centos 5 and using a script in /etc/logrotate.d which used to work with gluster 2.n which no longer seems to work... 
> 
> The logfile rotate script I've been using looks like this: 
> 
> [l3admin at oy-imageserver2 glusterfs]$ cat /etc/logrotate.d/glusterfs 
> /var/log/glusterfs/*.log /var/log/glusterfs/bricks/*.log { 
> sharedscripts 
> missingok 
> postrotate 
> /usr/bin/killall -HUP glusterfsd || true 
> endscript 
> } 
> 
> And currently the log files we have are: 
> 
> [l3admin at oy-imageserver2 ~]$ cd /var/log/glusterfs/ 
> [l3admin at oy-imageserver2 glusterfs]$ ls -lt | head 
> total 704144 
> -rw-r--r-- 1 root root 208508659 Nov 3 09:08 nfs.log.1 
> -rw-r--r-- 1 root root 8941 Nov 3 08:29 mnt-auto-shared.log 
> -rw-r--r-- 1 root root 2927576 Nov 3 05:09 mnt-auto-shared.log.1 
> -rw-r--r-- 1 root root 0 Nov 3 04:02 etc-glusterfs-glusterd.vol.log 
> -rw-r--r-- 1 root root 0 Nov 3 04:02 nfs.log 
> -rw-r--r-- 1 root root 21715 Nov 2 08:20 etc-glusterfs-glusterd.vol.log.7 
> -rw-r--r-- 1 root root 0 Nov 2 04:02 etc-glusterfs-glusterd.vol.log.1 
> -rw-r--r-- 1 root root 629632 Nov 2 04:02 mnt-auto-shared.log.2 
> -rw-r--r-- 1 root root 146007238 Nov 2 04:02 nfs.log.2 
> 
> 
> And as you can see the nfs log has been rotated but one of the processes is still writing to the old file... 
> 
> Also in the bricks subdirectory, the log file isn't getting rotated at all. 
> 
> Does anyone have a working logrotate script for RHEL/Centos?? 
> 
> Regards to all 
> 
> 
> Phil 
> 
> 
> -- 
> Director, Layer3 Systems Ltd 
> Layer3 Systems Limited is registered in England. Company no 3130393 
> 43 Pendle Road, Streatham, London, SW16 6RT 
> tel: 020 8769 4484 
> web: www.layer3.co.uk 
> 
> 
> 
> _______________________________________________ 
> Gluster-users mailing list 
> Gluster-users at gluster.org 
> http://gluster.org/cgi-bin/mailman/listinfo/gluster-users 

-- 
Director, Layer3 Systems Ltd 
Layer3 Systems Limited is registered in England. Company no 3130393 
43 Pendle Road, Streatham, London, SW16 6RT 
tel: 020 8769 4484 
web: www.layer3.co.uk 




_______________________________________________ 
Gluster-users mailing list 
Gluster-users at gluster.org 
http://gluster.org/cgi-bin/mailman/listinfo/gluster-users 


More information about the Gluster-users mailing list