Capturing Event Detail Message

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

Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Capturing Event Detail Message

Post by Jamesvanam »

HI, I was wondering if I could capture the Message from Event Detail WIndow from Director's log, so that I could use it in the job and send that message to a table.
Thanks in Advance.
Regards
James
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Can you clarify whether you want windows event viewer or DataStage job log to be captured.

If you want DataStage job log, you can obtain it by reading the corresponding RT_LOG file.

If you want Windows Event viewer log, you can ask the administrator to write it in a file and scan / monitor the file from DataStage. I recollect having a command level interface for this that I accessed from DataStage.
ArndW
Participant
Posts: 16318
Joined: Tue Nov 16, 2004 9:08 am
Location: Germany
Contact:

Post by ArndW »

JamesV,

from within DataStage you can write a Routine or Function that access the published routines to get this information. First use a call of

Code: Select all

MyJob = DSAttachJob("YourJobName",DSJ.ERRWARN)
to attach to your job, then you can use the DSGetLogSummary, DSGetLogEntry, or DSGetNewestLogId functions to retrieve the details on the entry in question. The documentation describes which options you have for these calls in detail.
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Post by Jamesvanam »

In my job I'm sending all the rejected reocrds to a procedure in which I would like to capture the warning message, this should happen at record level, like using a "outputlink.DBSCODE, which gets me only the DBSCODE but I need the whole message", for example this is the warning message I'd like to send to the output (procedure) link "XFM_Product:ORA-01400: cannot insert NULL into ("GPI"."T0013_PRODUCT"."UNITS_PER_PACKAGE")" this is the warning message from the log file. I want to use this as it is.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

Use log detail option.
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Post by Jamesvanam »

Could you please tell me where to find Log Detail option. I couldn't see it in DS functions, or macro's
THank you for your Help
James
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

You can get that from dsjob API as 'logdetail'.

Alternatively you can browse through the file RT_LOGnnn to obtain the information where nnn is the job number.
manteena
Premium Member
Premium Member
Posts: 38
Joined: Thu Feb 10, 2005 1:43 pm
Location: USA

Post by manteena »

Jamesvanam wrote:Could you please tell me where to find Log Detail option. I couldn't see it in DS functions, or macro's
THank you for your Help
James
You could try DSGetLogSummary funtion status of the job from Log.
Note: Pass sufficient paremeters to this function.
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Post by Jamesvanam »

I could use this function only in the JOB CONTROl, but I want to use it in the same job that throws the warnings.
it's like I need to get the message when it logs it in the Director.

I'm sorry If I'm being a pain in the neck. but please suggest me how to do it.

Thanks

your help is really appreciated.
Sainath.Srinivasan
Participant
Posts: 3337
Joined: Mon Jan 17, 2005 4:49 am
Location: United Kingdom

Post by Sainath.Srinivasan »

kduke
Charter Member
Charter Member
Posts: 5227
Joined: Thu May 29, 2003 9:47 am
Location: Dallas, TX
Contact:

Post by kduke »

If you download EtlStats from my tips page or from ADN then all you need is to run GenHtmlJobLog and give it the job name. It will email a web page with the log in an html table. Looks real nice. Super easy.

It would be easy to change this into a source query in a job and dump the log to a flat file or a table.
Mamu Kim
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

There is a function DSGetLogEntry for capturing the detail of a logged event. This requires the Event ID (a sequential number) of the event in question. You can determine the Event ID, for example by calling the function DSGetNewestLogId (which can filter on "warning" type).
You can find out more in on-line help (from Manager or Designer) or in the DataStage BASIC manual.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Post by Jamesvanam »

Thanks a lot guys, all the info was very helpful,
I've used DSGetLogSummary, and also other DS functions, and did some tweeking,
Regards
James
rgandra
Premium Member
Premium Member
Posts: 49
Joined: Mon Aug 02, 2004 9:31 am
Contact:

Post by rgandra »

Hi JAMES,

version:6.0
server:unix

Could you please post your code as i need the same thing. Right now i am using DSLOGSUMMARY to capture the log and send it in email, but as you know It won't give you the more detailed description of the warnings or errors( i mean as you see in event detail window) . In 6.0 i don't see any DSlogdetail function as well.


As most of the people understand my question if not more description what exactly i want:

example: if the error is beacause of Database user name is wrong. what i am getting is sql connection failed as you see in the log. But in the director if you click on the message the event detail message will tell you every thing about what you have entered in the user name field. I want that information too.

I mean whatever you see in RT_LOGnnn table. I know i can get the log from select * from rt_lognnn statement, but my jobcontrol will send you the email of the log as soon as the job is finished( i.e if possible i need the code in the same jobcontrol).

If anybody have any ideas please let me know

Thanks
sandeep
Jamesvanam
Participant
Posts: 40
Joined: Tue May 18, 2004 10:51 pm

Post by Jamesvanam »

Sandeep,

Code: Select all

DSGetLogSummary (DSJ.ME, DSJ.LOGWARNING, DSJobStartTimestamp, DSGetJobInfo (DSJ.ME, DSJ.JOBEOTTIMESTAMP), 2) 
I've used this code which gives me 2 entries, put 0 instead of 2 which gives you all the log, be careful in using this option, it limits the no. of events you can get from the log.

James
Post Reply