[torqueusers] Re: MOM log file rotation

Joshua Bernstein jbernstein at penguincomputing.com
Wed Sep 5 18:01:16 MDT 2007


As a follow up to my previous request, below is a patch to support a new 
option -l, that allows one to override the name of the directory the log 
files are written to rather then just the log file name. This is a diff 
against 2.1.8

---SNIP---
--- resmom.org/mom_main.c       2007-04-30 13:15:36.000000000 -0700
+++ resmom/mom_main.c   2007-09-05 12:47:55.000000000 -0700
@@ -5415,6 +5415,7 @@ void usage(
    fprintf(stderr,"  -d <PATH> \\\\ HOME DIR\n");
    fprintf(stderr,"  -C <PATH> \\\\ CHECKPOINT DIR\n");
    fprintf(stderr,"  -L <PATH> \\\\ LOGFILE\n");
+  fprintf(stderr,"  -l <PATH> \\\\ LOG DIR\n");
    fprintf(stderr,"  -M <INT>  \\\\ MOM PORT\n");
    fprintf(stderr,"  -p        \\\\ recover jobs\n");
    fprintf(stderr,"  -r        \\\\ recover jobs (2)\n");
@@ -5759,7 +5760,7 @@ int main(

    errflg = 0;

-  while ((c = getopt(argc,argv,"a:c:C:d:L:M:prR:S:vx")) != -1)
+  while ((c = getopt(argc,argv,"a:c:C:d:L:l:M:prR:S:vx")) != -1)
      {
      switch (c)
        {
@@ -5820,6 +5821,12 @@ int main(
          log_file = optarg;

          break;
+
+      case 'l':
+
+        path_log = optarg;
+
+        break;

        case 'M':

@@ -5989,7 +5996,9 @@ int main(
    path_prologuserp = mk_dirs("mom_priv/prologue.user.parallel");
    path_epilogpdel  = mk_dirs("mom_priv/epilogue.precancel");

-  path_log         = mk_dirs("mom_logs");
+  if (path_log == NULL)
+    path_log         = mk_dirs("mom_logs");
+
    path_spool       = mk_dirs("spool/");
    path_undeliv     = mk_dirs("undelivered/");
    path_aux         = mk_dirs("aux/");
---END SNIP---

-Joshua Bernstein
Software Engineer
Penguin Computing

Joshua Bernstein wrote:
> Hi,
> 
>     I really like the way that pbs_mom handles log files by naming them 
> with the date, and then automatically rotating them when the date changes.
> 
>     I have a few comments though:
> 
> 1) I see that pbs_mom takes -L option to override the log file location, 
> but if the argument to -L is a directory, then log creation fails.
> 
> 2) If I specify an argument to -L, then pbs_mom no longer manages the 
> file by naming it correctly, and properly rotating it.
> 
> It would be a nice if when the argument to -L is a directory, pbs_mom 
> simply uses that directory and manages the logs as it would if there was 
> no -L argument.
> 
> I could try and supply a patch to 2.1.8 to attempt to do this, but I'm 
> not sure the implications this would have to binaries like tracejob and 
> other accounting systems, such as the Moab tools.
> 
> Thoughts?
> 
> -Joshua Bernstein
> Software Engineer
> Penguin Computing
> 


More information about the torqueusers mailing list