Clear a logfile from a command line?

Post questions here relative to DataStage Server Edition for such areas as Server job design, DS Basic, Routines, Job Sequences, etc.

Moderators: chulett, rschirm, roy

Post Reply
RamonaReed
Participant
Posts: 26
Joined: Fri Feb 27, 2004 7:23 am
Location: WI, USA

Clear a logfile from a command line?

Post by RamonaReed »

Hi again everyone,

I'm still trying to clean up this rogue job. Is there some way I can clear the log file other than from within DataStage Director. The log file is so huge it's making DS Director hang up. I've tried numerous things to kill this process, but it will not go away, and the log files are being accessed by it, so I know something is still hanging the job. Any help would be appreciated.

Thanks again,
Mona
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

Open your Director, but do not go to the log view. From the main job listing screen, simply clear the log from there. You avoid having to view the log, which is impossible when you have a runaway job generating zillions of error messages. I'm assuming you ran the job with unlimited warning messages. :twisted:
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
RamonaReed
Participant
Posts: 26
Joined: Fri Feb 27, 2004 7:23 am
Location: WI, USA

Post by RamonaReed »

Thanks Kenneth,

I have tried that, but the Director just hangs. I wasn't the person who submitted this job, I'm was designated as the Administrator, so I'm left holding the bag, trying to kill this monster. I'm beside myself right about now. I've only worked with DataStage about a month, so this is quite beyond me. Any additional information to kill this would be appreciated.

Thanks again,
Mona
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

Be patient, it won't 'hang' for as long as opening the Log view would. Bringing up the Log requires that all zillion rows be brought up to your PC, while doing it from the Status view only requires it to find the oldest entry so it can give you an idea how much you will be purging.

Give it some time, it will come up.
-craig

"You can never have too many knives" -- Logan Nine Fingers
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

There is a last-ditch method of manually whacking the log file. It involves figuring out the jobs internal number, then executing either a DS CLEAR.FILE statement, a DELETE FROM SQL statement, or a DOS erase command to hard-kill the log contents. You can search the forum, this has been recently covered.

If you can't wait for the GUI way, let us know, we'll help you whack the log.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
RamonaReed
Participant
Posts: 26
Joined: Fri Feb 27, 2004 7:23 am
Location: WI, USA

Post by RamonaReed »

Thanks again Kenneth,

I have figured out the logs internal file number, but I'm not sure how to delete this log. It's RT_LOG403. When I tried to delete the actual server job, I get the following error: Cannot get excluse access to log for job DWAddress..... which is the name of the job I am trying to delete. We have copied the job to the project is should have been created under.

You all have been a great help, this is nerve wrecking.

Thanks again,
Mona
kcbland
Participant
Posts: 5208
Joined: Wed Jan 15, 2003 8:56 am
Location: Lutz, FL
Contact:

Post by kcbland »

If you currently have a Director open trying to view the log, you can't delete the job. You should kill your Director and get out of the job log.

Now, to manually clear the log file, you have several choices and can search the forum for more detail. You can use DS Administrator to execute a DS command directly to the project. That command will be "CLEAR.FILE RT_LOGxxx". This wipes out the auto-purge settings for the job as well, so remember to reset the value. I think you are going to delete the job anyway, so don't bother.
Kenneth Bland

Rank: Sempai
Belt: First degree black
Fight name: Captain Hook
Signature knockout: right upper cut followed by left hook
Signature submission: Crucifix combined with leg triangle
RamonaReed
Participant
Posts: 26
Joined: Fri Feb 27, 2004 7:23 am
Location: WI, USA

Post by RamonaReed »

Thanks a heap !!!
auvray.muriel
Participant
Posts: 43
Joined: Wed Feb 19, 2003 7:17 am
Location: France - Paris
Contact:

Post by auvray.muriel »

Hello,
I have a routine which was provided to me by the support Ascential France.
This routine Purges the logs of a job in function deu last RUN, of a date, or all the log.

*********************************************************
**WARNING : This routine should not be used to clear the logs of a running job.

**To use this routine :
**DEFFUN PurgeLogJob CALLING DSU.SupportFrance.PurgeLogJob(JobName,Action)
**Status = PurgeLogJob(JobName,Action)

**JobName : Variable containing the name of the job.
**Action : Variable containing the following :

** 1 - Action = "" if you want to clear the all log of the job.
** 2 - Action = "-1" if you want to clear all the log until the last execution of the job.
** 3 - Action = "DD/MM/YYYY" if you want to clear all the log entries until the indicated date.

** Status : Return code of the job.
** 1 - Status = 0 : the routine succes but no log entries are deleted.
** 2 - Satus = n : the routine success and deleted "n" log entries.
** 3 - Status = "text" : Error message.

** To test the status :
** IF NUM(Status) THEN
** IF Status THEN
** OK, Status entries deleted.
** END ELSE
** OK, 0 entries deleted.
** END
** END ELSE
** NOT OK !
** END
*********************************************


Code: Select all


*** Arg1 = Name of the job.
*** Arg2 = Type of Action to execute


      Ans=""
      Message = ""
$INCLUDE DSINCLUDE DSR_UVCONST.H
* FRM DSJobName *
$INCLUDE DSINCLUDE JOBCONTROL.H
* FIN FRM *
      Faire = TRIM(Action)

      IF (Faire # "") AND (Faire # "-1") THEN
         IF OCONV(ICONV(Faire,"D4/E"),"D4/E") # Faire THEN
            Message = "Improper Action entry"
            GOTO Erreur
         END ELSE
* This is a Date
            FaireDate = Faire[7,4]:"-":Faire[4,2]:"-":Faire[1,2]
            Faire = FaireDate
         END
      END


* Exclusive lock on the logs
      NomDuJob = TRIM(JobName)
      ExecAction = DSR.SUB.LOG.RESERVE
      Dummy = ""
      CALL @DSR.SUB.LOG(ExecAction,NomDuJob,Dummy)
      RetourPurge = NomDuJob
      IF ExecAction # "" THEN
         Message := ExecAction
         GOTO Erreur
      END

* Exclusive lock on the job.
      NomDuJob = TRIM(JobName)
      ExecAction = DSR.SUB.EXE.RESERVE
      Dummy = ""
      CALL @DSR.SUB.EXECJOB(ExecAction,NomDuJob,1,Dummy)
      IF ExecAction # "" THEN
         Message := ExecAction
         GOTO UnLockLog
      END

* Purge the log of the job.
      NomDuJob = TRIM(JobName)
      ExecAction = DSR.SUB.LOG.PURGE
      Dummy = ""
      CALL @DSR.SUB.LOG(ExecAction,NomDuJob,Faire)
      RetourPurge = NomDuJob
      IF ExecAction # "" THEN
         Message = RetourPurge:" lines, "
         Message := ExecAction
         GOTO UnLockJob
      END ELSE
         Ans = RetourPurge
      END

UnLockJob:*

* Unlock the job
      NomDuJob = TRIM(JobName)
      ExecAction = DSR.SUB.EXE.RELEASE
      Dummy = ""
      CALL @DSR.SUB.EXECJOB(ExecAction,NomDuJob,1,Dummy)
      IF ExecAction # "" THEN
         Message := ExecAction
         GOTO UnLockLog
      END

UnLockLog:*

* Unlock the logs
      NomDuJob = TRIM(JobName)
      ExecAction = DSR.SUB.LOG.RELEASE
      Dummy = ""
      CALL @DSR.SUB.LOG(ExecAction,NomDuJob,Dummy)
      RetourPurge = NomDuJob
      IF ExecAction # "" THEN
         Message := ExecAction
         GOTO Erreur
      END

* FRM *
* Get the current job's name and number:
      MyJobNo = DSJobName                ; * yes, really - input and output arg to next call
      SUBR = DSR.SUB.JOB
      Key = DSR.SUB.JOB.GETNO
      Call @SUBR(Key, MyJobNo)
      Dummy1 = "" ; Dummy2 = ""
* Gives hand to the current job *
      Call DSD.Init(MyJobNo, Dummy2)
* FIN FRM *



      IF Message = "" THEN GOTO FinNormale ELSE GOTO Erreur
Erreur:*
      Ans = Message
FinNormale:*

I it execute in a Job Control, and it goes very well :wink:

Good courage

Muriel
Post Reply