Make UNIX command disappear from the job log

A forum for discussing DataStage<sup>®</sup> basics. If you're not sure where your question goes, start here.

Moderators: chulett, rschirm, roy

Post Reply
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Make UNIX command disappear from the job log

Post by vivekgadwal »

Hello all,

I am just curious to find out how to make a UNIX command, executed from either a Before-job/After-job sub-routine or an Execute Command activity, disappear from the job's or the sequence's log. In other words, I want to "silently" (from a DataStage job log's perspective) execute a Unix script (which has password as one of the arguments).

The way DataStage is doing the execution right now is, it will provide a log entry for the command/script being executed. Unfortunately, this particular script has Database password being passed in as one of the input arguments. Even if I pass this password in the job from a Parameter Set (password entry is encrypted), the tool is generating the clear text during run-time and it is being displayed as part of the command being executed.

Thanks and do let me know if I need to provide any more information.
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
anbu
Premium Member
Premium Member
Posts: 596
Joined: Sat Feb 18, 2006 2:25 am
Location: india

Post by anbu »

Instead of passing password, store it in a file and inside your unix script read the file to get the password. Make sure to give proper permission to password file.
You are the creator of your destiny - Swami Vivekananda
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

anbu wrote:Instead of passing password, store it in a file and inside your unix script read the file to get the password. Make sure to give proper permission to password file.
Thanks Anbu.

This approach is implemented currently in this shop. However, the folks here want to get away from that approach because of some issues they faced earlier. I tried calling the script through DataStage and thus I came across this issue! Please let me know if there are any alternatives :).
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

You could always create your own before/after subroutine, which does not put the entry into the log. Adapt the code of whatever routine you're currently using.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

ray.wurlod wrote:You could always create your own before/after subroutine, which does not put the entry into the log. Adapt the code of whatever routine you're currently using.
Thanks Ray.

This is what I understood from your explanation: Create a "Server" routine and call the shell script from within it and make it not to display the command in the log. But, the jobs are in parallel and I cannot call this routine within that job. Could you please correct me if I understood you wrong?
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
shivajid2k
Participant
Posts: 19
Joined: Mon Feb 14, 2005 11:34 pm

Post by shivajid2k »

You can call the script using ExecSHSilent. Then the password will not appear in log.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

shivajid2k wrote:You can call the script using ExecSHSilent. Then the password will not appear in log.
Thanks a bunch. This was exactly what I was looking for! Is this functionality available for Sequence job as well?
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
ray.wurlod
Participant
Posts: 54607
Joined: Wed Oct 23, 2002 10:52 pm
Location: Sydney, Australia
Contact:

Post by ray.wurlod »

All before/after subroutines are server routines, whether they're called from server jobs or parallel jobs. They can not be called directly from sequences but a simple interlude could be constructed.

Code: Select all

FUNCTION ExecSHSilentInterlude(Arg1)
ErrorCode = 0
Call ExecSHSilent(Arg1, ErrorCode)
Ans = ErrorCode
RETURN(Ans)
Note - I need to check the Catalog name of ExecSHSilent to get this 100% correct, but won't be able to until I finish installing Information Server at my current site.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
narasimha
Charter Member
Charter Member
Posts: 1236
Joined: Fri Oct 22, 2004 8:59 am
Location: Staten Island, NY

Post by narasimha »

If you want to go the "Execute Command Activity" route -
Enter /NOLOG/ as the starting text in the parameter field.
This prevents the parameters from being logged in the job logs.
Narasimha Kade

Finding answers is simple, all you need to do is come up with the correct questions.
vivekgadwal
Premium Member
Premium Member
Posts: 457
Joined: Tue Sep 25, 2007 4:05 pm

Post by vivekgadwal »

narasimha wrote:If you want to go the "Execute Command Activity" route -
Enter /NOLOG/ as the starting text in the parameter field.
This prevents the parameters from being logged in the job logs.
Great!

I did not know DataStage has these facilities. Thanks Ray, narasimha, anbu and shivaji!
Vivek Gadwal

Experience is what you get when you didn't get what you wanted
Post Reply