summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-utils.c
diff options
context:
space:
mode:
authorvmallika <vmallika@redhat.com>2014-11-05 11:53:38 +0530
committerKrishnan Parthasarathi <kparthas@redhat.com>2014-11-12 03:23:59 -0800
commite607ca013f106bffe7f141d92a70e60c659c47d5 (patch)
tree64985cccf74f210c3630127b8fff3d62da7d0f61 /xlators/mgmt/glusterd/src/glusterd-utils.c
parent70b0c7b725408fc82969e15dcf67cd352b0fb68b (diff)
uss/gluster: Move all uss related logs into subfolder
For USS we have 1 snapd log per volume and as many snap logs for volume. For example if there are 4 volumes having 256 snaps each and USS is enabled than total number of logs under /var/log/glusterfs for USS would be 1028 logs. Total logs = (4(snapd per volume) + 4(volumes)*256(snaps)) = 1028 Hence, it makes sense to move into into sub-folder structure like /var/log/glusterfs/snaps/<vol-name>/<snapd + snaps logs> Change-Id: I29262e6458c3906916923cd67d1145d6ae10bec3 BUG: 1160534 Signed-off-by: vmallika <vmallika@redhat.com> Reviewed-on: http://review.gluster.org/9050 Tested-by: Gluster Build System <jenkins@build.gluster.com> Reviewed-by: Rajesh Joseph <rjoseph@redhat.com> Reviewed-by: Krishnan Parthasarathi <kparthas@redhat.com> Tested-by: Krishnan Parthasarathi <kparthas@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-utils.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index a455cc03a30..678405de241 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -13301,6 +13301,7 @@ glusterd_snapd_start (glusterd_volinfo_t *volinfo, gf_boolean_t wait)
runner_t runner = {0,};
char pidfile[PATH_MAX] = {0,};
char logfile[PATH_MAX] = {0,};
+ char logdir[PATH_MAX] = {0,};
char volfile[PATH_MAX] = {0,};
char glusterd_uuid [1024] = {0,};
char rundir[PATH_MAX] = {0,};
@@ -13342,8 +13343,16 @@ glusterd_snapd_start (glusterd_volinfo_t *volinfo, gf_boolean_t wait)
goto out;
}
- snprintf (logfile, PATH_MAX, "%s/%s-snapd.log",
+ snprintf (logdir, PATH_MAX, "%s/snaps/%s",
DEFAULT_LOG_FILE_DIRECTORY, volname);
+ ret = mkdir_p (logdir, 0755, _gf_true);
+ if ((ret == -1) && (EEXIST != errno)) {
+ gf_log (this->name, GF_LOG_ERROR, "Unable to create logdir %s",
+ logdir);
+ goto out;
+ }
+
+ snprintf (logfile, PATH_MAX, "%s/snapd.log", logdir);
snprintf (volfileid, sizeof (volfileid), "snapd/%s", volname);
glusterd_set_snapd_socket_filepath (volinfo, sockfpath,
@@ -13357,9 +13366,8 @@ glusterd_snapd_start (glusterd_volinfo_t *volinfo, gf_boolean_t wait)
runinit (&runner);
if (priv->valgrind) {
- snprintf (valgrind_logfile, PATH_MAX,
- "%s/valgrind-%s-snapd.log",
- DEFAULT_LOG_FILE_DIRECTORY, volname);
+ snprintf (valgrind_logfile, PATH_MAX, "%s/valgrind-snapd.log",
+ logdir);
runner_add_args (&runner, "valgrind", "--leak-check=full",
"--trace-children=yes", "--track-origins=yes",