Simple GlusterFS log rotation

Simple GlusterFS log rotation

Category : How-to

Get Social!

gluster-orange-ant

You’ll be glad to know that GlusterFS has built in log rotation! This means that you can use a simple gluster command to rotate the log for a specific volume. This is very helpful when troubleshooting where it can be easiest to truncate logs before regenerating the issue.

For enduring log rotation I recommend using logrotate which I will cover in a future blog post.

Logs are rotated per volume, so you will need to know the volume name before issuing the command to rotate the log. Use the below command to list all the volumes available on your server:

gluster volume info all | grep "Volume Name"

Use the gluster command, replacing [VOL_NAME] with the volume name of the log file you would like to rotate.

gluster volume log rotate [VOL_NAME]

In the below example, the logs for volume datastore will be rotated.

gluster volume log rotate datastore

Below is the result on the file system displayed with the ls command.

ls -l /var/log/glusterfs/bricks/
total 28
-rw------- 1 root root 119 Nov 1 19:06 mnt-gfs_block.log
-rw------- 1 root root 9085 Nov 1 13:46 mnt-gfs_block.log.1383313581
-rw------- 1 root root 236 Nov 1 13:48 mnt-gfs_block.log.1383313684
-rw------- 1 root root 236 Nov 1 13:49 mnt-gfs_block.log.1383313742
-rw------- 1 root root 236 Nov 1 19:06 mnt-gfs_block.log.1383332808

And that’s it! Your log file will be moved and have a time stamp appended, and a new log will be started for the volume.

See my other post on using logrotate for more advanced log rotation.


Related posts:


2 Comments

Danny

4-Feb-2014 at 7:54 pm

I’m pretty sure that “locate” is supposed to be “rotate” in the commands above. :)

    james.coyle

    6-Feb-2014 at 8:17 pm

    I have updated the type – thanks!

Leave a Reply to Danny Cancel reply

Visit our advertisers

Search

Quick Poll

How often do you change the password for the computer(s) you use?

Visit our advertisers