You can use the CONTAINS "JobName: uniquejob" option on the LOG QUERY
request.

For example:

$ STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME
STAX_Service FROM 20100414
Response
--------
Date-Time         Level Message
----------------- -----
-------------------------------------------------------
20100414-08:09:41 Info    Registered Extensions for stax Version 3.4.1:
20100414-08:12:31 Start JobID: 1, File: c:\staxtest\notepad.xml, Machine:
local
                        ://local, Function: main, Args: null, JobName:
DaveJobA
20100414-08:12:35 Stop  JobID: 1
20100414-08:12:39 Start JobID: 2, File: c:\staxtest\notepad.xml, Machine:
local
                        ://local, Function: main, Args: null, JobName:
DaveJobB
20100414-08:12:41 Stop  JobID: 2
20100414-08:12:46 Start JobID: 3, File: c:\staxtest\notepad.xml, Machine:
local
                        ://local, Function: main, Args: null, JobName:
DaveJobC
20100414-08:12:48 Stop  JobID: 3
20100414-08:12:53 Start JobID: 4, File: c:\staxtest\notepad.xml, Machine:
local
                        ://local, Function: main, Args: null, JobName:
DaveJobD
20100414-08:12:55 Stop  JobID: 4

$ STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME
STAX_Service FROM 20100414 CONTAINS "JobName: DaveJobC"
Response
--------
Date-Time         Level Message
----------------- -----
-------------------------------------------------------
20100414-08:12:46 Start JobID: 3, File: c:\staxtest\notepad.xml, Machine:
local
                        ://local, Function: main, Args: null, JobName:
DaveJobC

Thanks,
David


                                                                       
 David Bender          11501 Burnet Rd.   Phone (T/L): 1-512-286-5315  
 STAF/STAX Development Bldg. 903-5B002    (363-5315)                   
                       Austin, TX         ITN: 23635315                
 IBM Software Group,   78758-3400         Email: bda...@us.ibm.com     
 WPLC                                                                  
                                                                       
                                                                       






                                                                       
  From:       Sangram Bakshi <san...@gmail.com>                        
                                                                       
  To:         Sharon Lucas/Austin/i...@ibmus                            
                                                                       
  Cc:         staf-users@lists.sourceforge.net                         
                                                                       
  Date:       04/14/2010 02:18 AM                                      
                                                                       
  Subject:    Re: [staf-users] How to use STAF apis to access staf job id 
related       Logs
                                                                       





Hi Sharon,

I was trying to get job list by job name.

I tried to  add  jobname here
C:\>STAF local LOG QUERY MACHINE {STAF/Config/MachineNickName} LOGNAME
STAX_Service FROM 20100325 LEVELMASK Start


eg:

C:\>STAF local LOG QUERY MACHINE {STAF/Config/MachineNickName} LOGNAME
STAX_Service JOBNAME uniquejob FROM 20100325 LEVELMASK Start

I am not able to do so . How can get the output by jobname.


Regards
Sangram


On Mon, Apr 5, 2010 at 11:20 PM, Sharon Lucas <luc...@us.ibm.com> wrote:

  Yes, of course you need to know the job id to get job logs for a
  particular STAX job.

  Do you only want to know the job ids for STAX jobs that are currently
  running?  If so, then you can submit the following request

     STAF local STAX LIST JOBS

  and iterate through the unmarshalled list of STAX jobs which includes the
  STAX job IDs.  This is what the STAX Monitor submits to get a list of
  currently running STAX jobs.

  Otherwise, if you want to know the job ids for any STAX jobs, or any STAX
  job submitted on a particular day, etc, you can query the STAX service
  log which contains a Start and Stop record for each STAX job and and Info
  record for each time the STAX service is registered.  The STAX service
  log talked about in section "STAX Logging" in the STAX User's Guide at
  http://staf.sourceforge.net/current/STAX/staxug.html#Header_StaxLogging.

  For example, to list all the Start records for STAX jobs that were
  started on March 25, 2010 or later:


  C:\>STAF local LOG QUERY MACHINE {STAF/Config/MachineNickName} LOGNAME
  STAX_Service FROM 20100325 LEVELMASK Start
  Response
  --------
  Date-Time Level Message
  --------- -----
  ---------------------------------------------------------------
  20100325- Start JobID: 1, File: c:\dev\sf\src\staf\test\STAFTest.xml,
  Machine:
  14:42:38        local://local, Function: DoAll, Args: null, JobName:
  STAFTest
  20100325- Start JobID: 2, File: c:\dev\sf\src\staf\test\STAFTest.xml,
  Machine:
  14:45:13        local://local, Function: DoAll, Args: null, JobName:
  STAFTest
  20100326- Start JobID: 3, File: c:\dev\sf\src\staf\test\STAFTest.xml,
  Machine:
  09:08:28        local://local, Function: DoAll, Args: null, JobName:
  STAFTest

  --------------------------------------------------------------
  Sharon Lucas
  IBM Austin,   luc...@us.ibm.com
  (512) 286-7313 or Tieline 363-7313





                                                                       
 Sangram Bakshi <                                                      
 san...@gmail.com>                                                     
                                                                       
                                                                      To
 04/05/2010 12:28 PM               Sharon Lucas/Austin/i...@ibmus       
                                                                      cc
                                   staf-users@lists.sourceforge.net    
                                                                 Subject
                                   Re: [staf-users] How to use STAF apis
                                   to access staf job id related       
                                   Logs                                
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       







  Hi Sharon,

  Thanks .  But in real time how would we know the job ids , is there any
  api to know the current jobids .
  This is would be needed to program in a loop and get the logs for each
  job id.



  Regards
  Sangram




  On Mon, Apr 5, 2010 at 10:11 PM, Sharon Lucas <luc...@us.ibm.com> wrote:

  The STAX job logs are STAF logs that can be queried using the STAF Log
  service's QUERY request.  Detailed information is provided in subsections
  "Querying STAX Job Logs" and "Querying STAX Job User Logs" in section
  "STAX Logging" in the STAX User's Guide at
  http://staf.sourceforge.net/current/STAX/staxug.html#Header_StaxLogging.

  For example, if submitted from the STAX service machine (specify the STAX
  job ID in the log name that you want to query):

  STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME
  STAX_Job_1
  STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME
  STAX_Job_1_User

  You can use the STAF APIs provided for submitting a STAF command via C+
  +/Java/Perl/Python/Tcl or use a <stafcmd> in a STAX job or submit via a
  shell script or .bat file.

  The log contents are returned as marshalled data in the result string (as
  talked about in the Results section for the Log Service in the STAF Users
  Guide).  You can  use the STAF APIs provided to format the marshalled
  data into a readable format (this is not specific to a LOG QUERY request)
  in whatever language you choose and then you can write the formatted
  string output to a file.  Or if you use STAF.exe  via the command line, a
  shell script, or a .bat file.  STAF.exe automatically unmarshalls and
  formats the result for you and you can redirect its output to a file.
  For example:

  STAF local LOG QUERY MACHINE {STAF/Config/MachineNickname} LOGNAME
  STAX_Job_1 > C:/temp/job1.txt

  Or, you can use the FmtLog utility provided by STAF.  This is discussed
  in section "Format Log Utility" in the STAF User's Guide at
  http://staf.sourceforge.net/current/STAFUG.htm#HDRFMTLOG

  --------------------------------------------------------------
  Sharon Lucas
  IBM Austin,   luc...@us.ibm.com
  (512) 286-7313 or Tieline 363-7313

                                                                       
 Sangram Bakshi <                                                      
 san...@gmail.com>                                                     
                                                                       
                                                                    To 
 04/05/2010 11:09 AM                staf-users@lists.sourceforge.net   
                                                                    cc 
                                                                       
                                                               Subject 
                                    [staf-users] How to use STAF apis  
                                    to access staf job id related Logs 
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       
                                                                       







  Hi ,

  I have a staf job written , where i have logs mentioned , which come up
  on the STAX Monitor.
  I would like write  a program using c/java/perl whatever STAF
  supports . In this program  i would like to
  access the logs generated while running the STAF jobs. I want to access
  these logs and direct them to a file.


  Please do suggest if this can be achieved through any STAF apis
  available .

  Regards
  Sangram
  ------------------------------------------------------------------------------

  Download Intel&#174; Parallel Studio Eval
  Try the new software tools for yourself. Speed compiling, find bugs
  proactively, and fine-tune applications for parallel performance.
  See why Intel Parallel Studio got high marks during beta.
  
http://p.sf.net/sfu/intel-sw-dev_______________________________________________

  staf-users mailing list
  staf-users@lists.sourceforge.net
  https://lists.sourceforge.net/lists/listinfo/staf-users




------------------------------------------------------------------------------

Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users





<<inline: graycol.gif>>

<<inline: ecblank.gif>>

------------------------------------------------------------------------------
Download Intel&#174; Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
staf-users mailing list
staf-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/staf-users

Reply via email to