Page 1 of 1

clearing log files at one shot

Posted: Tue Oct 21, 2008 7:14 am
by major
Hi,

I have read somewhere that clear.&ph& command would clear all log files of a particular project at one shot, if executed at command line at datastage admin .

I tried in vain.Any suggestions about that command would be helpful

Posted: Tue Oct 21, 2008 7:22 am
by DS_SUPPORT
CLEAR.&PH& wont clear the log files, as you are thinking.

For clearing the log file , you need to execute the command

Code: Select all

CLEAR.FILE RT_LOGXXX
where XXX is the job number. you can get the job number by querying DS_JOBS. but if you just execute this , it will clear your auto purge settings also.

For clearing the Job log, with preserving Auto Purge Settings, Our DS Masters have posted the routines already, Do a search in the forum.

Posted: Tue Oct 21, 2008 7:24 am
by chulett
"CLEAR.FILE &PH&" simply clears that "phantom" directory in the attached project. There is no command to "clear all log files in one shot".

Posted: Tue Oct 21, 2008 12:53 pm
by kduke
There was one on the ADN. It would take a while and each each job's log file. It might be on my tips page. If not then I could post it.

Posted: Thu Jan 08, 2009 4:30 am
by JeroenDmt
kduke wrote:There was one on the ADN. It would take a while and each each job's log file. It might be on my tips page. If not then I could post it.
Could you post it? I've been searching in dsxchange and found several references to the ADN one, but haven't been able to find any solution to clear all the log files in a project.
I don't see it on your tips page.

Posted: Thu Jan 08, 2009 8:44 am
by chulett

Posted: Thu Jan 08, 2009 9:27 am
by JeroenDmt
Thanks!

Posted: Thu Jan 08, 2009 10:00 am
by chulett
Be aware of what it is doing - getting a list of job numbers and issuing a CLEAR.FILE for each one in a loop, which means you'll lose all of your auto purge information. However, there is another Ken Bland utility out there to set them all as well. Not 'preserve' but set.

Posted: Thu Jan 08, 2009 10:42 am
by JeroenDmt
Do you accidentally know where to find that one?

Posted: Thu Jan 08, 2009 10:47 am
by chulett
Accidentally? As a matter of fact...

viewtopic.php?t=106690

:D

Posted: Thu Jan 08, 2009 12:48 pm
by JeroenDmt
Great! Thanks :D

Posted: Thu Jul 23, 2009 1:19 am
by sbass1
(May as well just add to this thread rather than starting a new one)

So I read this thread, and also
viewtopic.php?t=82586, and
viewtopic.php?t=106690

See also
viewtopic.php?t=128396&highlight=

Plagiarizing from viewtopic.php?t=82586 above, I've written this simple routine:

Code: Select all

TCL = "CLEAR.FILE RT_LOG" : pJobNumber
Call DSExecute("TCL", TCL, ScreenOutput, SystemReturnCode) 
Ans = ScreenOutput : @VM : SystemReturnCode
Using the same approach as in viewtopic.php?t=128396&highlight= to loop over the jobs in the project, I can clear the desired logs in the project. Further enhancements are parsing the Ans text to write to the log or sequential file, etc.

However, I read this also deletes auto purge settings, etc.

Is there a better way, or is this best practice to, as the subject says, "clear logs files in one shot"?

Thanks,
Scott

Posted: Thu Jul 23, 2009 1:27 am
by ArndW
I just spent weeks writing a program which manages log files - you can choose whether by date, or runs or number of log entries and it cleans up broken multi-instance and job run data plus it reorganizes remaining data and performs other housekeeping. Entries removed are archived to an Oracle database. All this work because this site doesn't want to lose log entries. The CLEAR.FILE approach works quite well and is fast and efficient. If you wanted to be clean, you could read or copy the //PURGE.SETTINGS record prior to clearing the file and then writing it back to the new and pristine log file. The other control records in the log file, "//SEQUENCE.NO" and "//JOB.STARTED.NO" don't need to be kept if all of the log entries that they refer to are cleared.

Posted: Thu Jul 23, 2009 4:51 pm
by ray.wurlod
Scott wrote:Is there a better way, or is this best practice to, as the subject says, "clear logs files in one shot"?
Use the auto-purge settings. Maybe with tighter rules than you currently have in place. That's what I'd regard as best practice.

Posted: Thu Jul 23, 2009 5:33 pm
by sbass1
ray.wurlod wrote:
Scott wrote:Is there a better way, or is this best practice to, as the subject says, "clear logs files in one shot"?
Use the auto-purge settings. Maybe with tighter rules than you currently have in place. That's what I'd regard as best practice.
Thanks Ray. I'm currently just using this utility in our DEV environment, where job creation is very dynamic, and the large logs (usually due to thousands of warnings) make reading the logs slow.

I'll ensure we set proper auto-purge settings for our PRD environment.