2 Replies Latest reply on Oct 30, 2013 10:46 AM by PavelI NameToUpdate

    Possibility to get all log items from all jobs that are under a batch job

      Hello,

      Is it possible to get all log items from all jobs that are under a batch job?

       

      It is possible to get logs from one job directly using this command:

      blcli_execute JobRun getLogItemsByJobRunId ${JobDBKey} ${JobRunId}

       

      But when I have a batch job, it will return just information about success/fail of the particular job not the log messages from the job itself.

      Has anyone ever tried to dig into the batch job and get log items of particular jobs using script?

       

      PavelI

        • 1. Re: Possibility to get all log items from all jobs that are under a batch job

          Yes you can get the Log items for a specified job run id

          you can last run id as well, I assume you are familair with those blcli commands

          you need to do this

           

          use BatchJob  findAllSubJobHeadersByBatchJobKey api command

           

          1. get db key of batch job
          2. Call BatchJob  findAllSubJobHeadersByBatchJobKey api command to get list of db keys of child jobs
          3. for each child job do following
            1. blcli_execute getLastRunId jobkey
            2. blcli_storeenv runkey
            3. blcli_execute JobRun getLogItemsByJobRunId $jobkey   $runkey

          HTH !

          1 of 1 people found this helpful
          • 2. Re: Possibility to get all log items from all jobs that are under a batch job

            I tried several aproaches on how to put it together. At the end I did it by processing two branches.

            My code look like this:

             

            batchJobDBKey=$1

            batchJobRunId=$2

             

            let i=1    #Iterator

             

            #Gather DBKeys for all subjobs from a batch job

            blcli_execute BatchJob findAllSubJobHeadersByBatchJobKey $batchJobDBKey

            blcli_execute SJobHeader getJobId

            blcli_execute Utility setTargetObject

            blcli_execute Utility listPrint

            blcli_storeenv subJobIds

            for subJobId in $subJobIds

            do

                blcli_execute Job getLastJobDBKeyByJobId $subJobId

                blcli_storeenv subJobDBKey

                subJobDBKeyArray[${i}]=${subJobDBKey}

                let i++

            done

             

            let i=1    #Reset the iterator

             

            #Get log messages for all jobs from the batch job

            blcli_execute BatchJobRun getMemberJobRunsByBatchJobRun $batchJobDBKey $batchJobRunId

            blcli_execute JobRun getJobRunId

            blcli_execute Utility setTargetObject

            blcli_execute Utility listPrint

            blcli_storeenv subJobRunIds

            for subJobRunId in $subJobRunIds

            do

                blcli_execute JobRun getLogItemsByJobRunId $subJobDBKeyArray[$i] $subJobRunId

                blcli_storeenv subJobRunLogMessage

                let i++

            done