Job Log file extraction from UNIX / Admin

Post questions here relative to DataStage Enterprise/PX Edition for such areas as Parallel job design, Parallel datasets, BuildOps, Wrappers, etc.

Moderators: chulett, rschirm, roy

Post Reply
mandyli
Premium Member
Premium Member
Posts: 898
Joined: Wed May 26, 2004 10:45 pm
Location: Chicago

Job Log file extraction from UNIX / Admin

Post by mandyli »

Hi


Hi

I would like to extract log information for particular job. I am executing following command from Data stage Administration Command Line (Interface)

SELECT @ID,TYPE,WAVE.NO,TIMESTAMP,MSG.ARGS,MSG.TEXT,FULL.TEXT,SEVERITY FROM RT_LOG974

But I am not able to save this information. I tried via XMETA table also.
If any only help me how to get log information via file.


Thanks
Man
asorrell
Posts: 1707
Joined: Fri Apr 04, 2003 2:00 pm
Location: Colleyville, Texas

Post by asorrell »

Ok- you are making me dredge up ancient history from the old memory banks... but if I remember correctly, the easiest way to capture screen output from the command line shell is with the COMO (command output) command.

Syntax is
  • - Capture all output into a file: COMO ON filename
    - Turn off Capture: COMO OFF
    - List all output files: COMO LIST
    - Delete existing output file: COMO DELETE filename
I'm not certain if you can get it to work from the admin console, but you can try it. I know it will definitely work when you are logged into the DataStage shell (uvsh or dssh).

From the UNIX level, the output files are stored in a sub-directory called &COMO&. This will be either in your project directory or in the main $DSHOME directory depending on where the command is being executed. Since you are on UNIX, the "&" special character must be prefixed with a back-slash in pathnames: ie: cd \&COMO\&

Hope that helps!

Historical Note: the strangely named COMO command was taken from the 1970's PRIMOS operating system that hosted the Prime Information database - a precursor of the UniVerse database that became the DataStage shell. http://en.wikipedia.org/wiki/PRIMOS
Andy Sorrell
Certified DataStage Consultant
IBM Analytics Champion 2009 - 2020
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

asorrell wrote:I'm not certain if you can get it to work from the admin console, but you can try it.
Works fine from there. There are also posts here showing how to launch a dssh session from the command line, run a sql and redirect the output to a file that a search should turn up.
-craig

"You can never have too many knives" -- Logan Nine Fingers
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

Where are you trying to do this - interactively or in a server routine? There are some neat tricks in the latter case.

From the operating system command line you can use redirection operator.

From TCL you can use COMO or DIVERT.OUT commands to capture output.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
mandyli
Premium Member
Premium Member
Posts: 898
Joined: Wed May 26, 2004 10:45 pm
Location: Chicago

Post by mandyli »

Thanks for your mail.

Where I need to execute this command?


from Datastage admin or via UNIX.
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

As noted, from the command line shell - meaning 'dssh', that or the Administrator, assuming an interactive session.
-craig

"You can never have too many knives" -- Logan Nine Fingers
hailun
Participant
Posts: 40
Joined: Fri Nov 07, 2008 9:07 am

Re: Job Log file extraction from UNIX / Admin

Post by hailun »

#! /bin/Ksh
export DSHOME=`cat /.dshome`
export PATH=$PATH:$DSHOME/bin
proj_name=$1
job_name=$2
hash_num=null
#job_name=`echo $2 | tr "[:lower:]" "[:upper:]"`
echo Project_name: "$proj_name"
echo Job name: $job_name
if [ -f $DSHOME/dsenv ]
then
. $DSHOME/dsenv
else
echo "dsenv File doesn't exist"
fi
#cd `cat /.dshome`
cd "$DSHOME"
dssh "SELECT PATH FROM UV_SCHEMA WHERE SCHEMA_NAME='"$proj_name"'">/home/dsadm/hailun/temp_test
path=`sed -n '4p' /home/dsadm/hailun/temp_test|cut -f 2 -d " "`
echo Project_Path: $path
get_hash (){
a=$1
b=$2
c=$3
cd $a
dssh<<eof
LOGTO $b
SELECT JOBNO FROM DS_JOBS WHERE NAME = '$c';
quit
eof
}
write_job_log (){
a=$1
b=$2
c=$3
cd $a
dssh<<eof
LOGTO $b
SELECT * FROM RT_LOG$c ORDER BY TIMESTAMP,@ID;
quit
eof
}
get_hash $DSHOME $proj_name $job_name >/home/dsadm/hailun/a
#echo $hash_num
hash_num=`sed -n '9p' /home/dsadm/hailun/a`
echo hash_num: $hash_num
write_job_log $DSHOME $proj_name $hash_num >/home/dsadm/hailun/b
cat /home/dsadm/hailun/b | sed /^$/d|sed /'=SQL+'/d |sed /'JSeverity Full Text.......'/d|sed '1,7d' >/home/dsadm/hailun/`date "+%Y%m%d%H%#M"`_"$proj_name"_"$job_name".log
cd
cd hailun
rm -f temp_test
rm -f a
rm -f b

Run the shell sctript by following format:
shell $project_name $job_name
And you will get what you need,

FYI
Thanks
Man
Last edited by hailun on Thu Oct 15, 2009 8:16 pm, edited 3 times in total.
Let's Progress Together....
chulett
Charter Member
Charter Member
Posts: 43085
Joined: Tue Nov 12, 2002 4:34 pm
Location: Denver, CO

Post by chulett »

You need to learn how to post more better. That is not how one quotes another post. :?
-craig

"You can never have too many knives" -- Logan Nine Fingers
bcarlson
Premium Member
Premium Member
Posts: 772
Joined: Fri Oct 01, 2004 3:06 pm
Location: Minnesota

Post by bcarlson »

How about using the dsjob command? From Unix:

Code: Select all

dsjob <your connection parms> -logdetail <proj> <job> -wave 0
We have a wrapper that we use to kick off all DS job and it ends by pulling the logs with the above command, reformatting a bit and outputing to a log file.

Brad.
It is not that I am addicted to coffee, it's just that I need it to survive.
Post Reply