Page 1 of 1

Job Log file extraction from UNIX / Admin

Posted: Fri Oct 09, 2009 5:05 pm
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

Posted: Mon Oct 12, 2009 8:23 am
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

Posted: Mon Oct 12, 2009 9:12 am
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.

Posted: Mon Oct 12, 2009 2:22 pm
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.

Posted: Mon Oct 12, 2009 3:56 pm
by mandyli
Thanks for your mail.

Where I need to execute this command?


from Datastage admin or via UNIX.

Posted: Mon Oct 12, 2009 4:26 pm
by chulett
As noted, from the command line shell - meaning 'dssh', that or the Administrator, assuming an interactive session.

Re: Job Log file extraction from UNIX / Admin

Posted: Tue Oct 13, 2009 2:06 am
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

Posted: Tue Oct 13, 2009 5:45 am
by chulett
You need to learn how to post more better. That is not how one quotes another post. :?

Posted: Thu Oct 15, 2009 7:58 am
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.