8 Replies Latest reply on Aug 28, 2020 4:32 PM by Bill Robinson

    blcli export PatchAnalysis Job Log per Server

    Denis Knebel
      Share This:

      Hi @All,

       

      i have a problem with exporting the complete job-log from a patchanalysis job.

       

      i've found out to export the Analysis Log. But this is not usefull for me.

       

      i want to export the Log per server, like the Log-Grid in the console.

       

      has anyone built something like this before?

        • 1. Re: blcli export PatchAnalysis Job Log per Server
          Bill Robinson
          i've found out to export the Analysis Log. But this is not usefull for me.

          what blcli command are you using ?  why is that output not useful ?

           

          i want to export the Log per server, like the Log-Grid in the console.

          can you show an example of exactly what you are looking for ? there's a lot of places to export logs from the gui.  which one are you using ?

          • 2. Re: blcli export PatchAnalysis Job Log per Server
            Denis Knebel

            for export i use :

            blcli_execute JobRun getLogItemsByJobRunId $jobrunid

            this works. but i see the log chronologically.

             

            the Patchanalysis runs against serveral Servers.

             

            in the Log-View of the console, i can see the same, but under the Analysis job, there is a Server separated list with the logs only for this server.

            • 3. Re: blcli export PatchAnalysis Job Log per Server
              Bill Robinson

              so you want this:

               

              ?

               

              for each server ?  the job run log, not the patching results ?

               

              i don't see a single command, you can use something like this:

              # blcli_execute LogItem getLogItemsByDevice DBKey:SJobKeyImpl:2001703-2 2011805 2000300

              # blcli_execute Utility listPrint

              Type: Info Date: Tue Jun 02 15:40:29 EDT 2020 Message: Copying metadata WindowsPatchData.zip to the server: win19-2002.example.com

              Type: Info Date: Tue Jun 02 15:40:31 EDT 2020 Message: Metadata WindowsPatchData.zip copied to the server: win19-2002.example.com

              Type: Info Date: Tue Jun 02 15:40:31 EDT 2020 Message: Starting analyzer execution on server: win19-2002.example.com

              Type: Info Date: Tue Jun 02 15:40:44 EDT 2020 Message: Analyzer execution complete on server: win19-2002.example.com , exitCode: 0

              Type: Info Date: Tue Jun 02 15:40:45 EDT 2020 Message: Copying analysis results xml from server: win19-2002.example.com

              Type: Info Date: Tue Jun 02 15:40:45 EDT 2020 Message: Parsing analysis results for server: win19-2002.example.com

              Type: Info Date: Tue Jun 02 15:40:45 EDT 2020 Message: Creating analysis result items for server: win19-2002.example.com

               

              that will require:

              getting the patching job run, getting the child analysis job run id and job key, getting all the target server ids, and then looping for each target.

               

              if that's what you want, i can show the rest of the commands...

              1 of 1 people found this helpful
              • 4. Re: blcli export PatchAnalysis Job Log per Server
                Denis Knebel

                that's exactly what i want.

                • 5. Re: blcli export PatchAnalysis Job Log per Server
                  Denis Knebel

                  Bill Robinson wrote:

                   

                  if that's what you want, i can show the rest of the commands...

                  please, could you share the rest of the commands?

                  • 6. Re: blcli export PatchAnalysis Job Log per Server
                    Bill Robinson

                    do you want the logs from just failed targets or all of them ?

                    • 7. Re: blcli export PatchAnalysis Job Log per Server
                      Denis Knebel

                      i want the log from all targets.

                      • 8. Re: blcli export PatchAnalysis Job Log per Server
                        Bill Robinson

                        assuming you have the job run id for the patching job:

                         

                        blcli_execute JobRun findPatchingJobChildrenJobsByRunKey ${jobRunId}

                        blcli_execute JobRun getJobRunId

                        blcli_execute Utility setTargetObject

                        blcli_execute Utility listPrint

                        blcli_storeenv jobRunIds

                        while read childRunId

                                do

                                blcli_execute JobRun findById ${childRunId}

                                blcli_execute JobRun getType

                                blcli_storeenv jobRunTypeId

                                blcli_execute JobRun getJobKey

                                blcli_storeenv childJobKey

                                if [[ ${jobRunTypeId} != 7033 ]]

                                        then

                                        blcli_execute JobRun getServersStatusByJobRun ${childRunId}

                                        blcli_execute Utility mapPrint

                                        blcli_execute Utility setTargetObject

                                        blcli_storeenv targetList

                                        while read serverKey

                                                do

                                                blcli_execute Server findByDBKey ${serverKey}

                                                blcli_execute Server getServerId

                                                blcli_storeenv serverId

                                                blcli_execute Server getName

                                                blcli_storeenv serverName

                                                blcli_execute LogItem getLogItemsByDevice ${childJobKey} ${childRunId} ${serverId}

                                                blcli_execute Utility listPrint

                                                blcli_execute Utility setTargetObject

                                                blcli_storelocal serverLogItems

                                                echo "****************** ${serverName} **********************"

                                                echo "${serverLogItems}"

                                                echo "*******************************************************"

                                        done <<< "$(awk 'NF' <<< "${targetList}" | awk '{print $1}')"

                                fi

                        done <<< "$(awk 'NF' <<< "${jobRunIds}")"

                         

                        spits out:

                        ****************** win19-2002.example.com **********************

                        Type: Info Date: Fri Aug 28 17:21:51 EDT 2020 Message: Copying metadata WindowsPatchData.zip to the server: win19-2002.example.com

                        Type: Info Date: Fri Aug 28 17:21:52 EDT 2020 Message: Metadata WindowsPatchData.zip copied to the server: win19-2002.example.com

                        Type: Info Date: Fri Aug 28 17:21:52 EDT 2020 Message: Starting analyzer execution on server: win19-2002.example.com

                        Type: Info Date: Fri Aug 28 17:22:06 EDT 2020 Message: Analyzer execution complete on server: win19-2002.example.com , exitCode: 0

                        Type: Info Date: Fri Aug 28 17:22:07 EDT 2020 Message: Copying analysis results xml from server: win19-2002.example.com

                        Type: Info Date: Fri Aug 28 17:22:07 EDT 2020 Message: Parsing analysis results for server: win19-2002.example.com

                        Type: Info Date: Fri Aug 28 17:22:07 EDT 2020 Message: Creating analysis result items for server: win19-2002.example.com

                         

                         

                        *******************************************************

                        ****************** win19-894p3.example.com **********************

                        Type: Info Date: Fri Aug 28 17:21:54 EDT 2020 Message: Copying metadata WindowsPatchData.zip to the server: win19-894p3.example.com

                        Type: Info Date: Fri Aug 28 17:21:56 EDT 2020 Message: Metadata WindowsPatchData.zip copied to the server: win19-894p3.example.com

                        Type: Info Date: Fri Aug 28 17:21:56 EDT 2020 Message: Starting analyzer execution on server: win19-894p3.example.com

                        Type: Info Date: Fri Aug 28 17:22:09 EDT 2020 Message: Analyzer execution complete on server: win19-894p3.example.com , exitCode: 0

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Copying analysis results xml from server: win19-894p3.example.com

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Parsing analysis results for server: win19-894p3.example.com

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Creating analysis result items for server: win19-894p3.example.com

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Excluding patch: 'windows10.0-Server-kb4523204-x64-1809.msu-MS19-11-SSU-4523204-en-Windows Server 2019 Standard-Gold' from analysis results (based on the patch exclude list for server win19-894p3.example.com)

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Excluding patch: 'windows10.0-Server-kb4532947-x64-1809.msu-MS20-01-MRNET-4535101-en-Windows Server 2019 Standard-Gold' from analysis results (based on the patch exclude list for server win19-894p3.example.com)

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Excluding patch: 'windows10.0-Server-kb4532691-x64-1809.msu-MS20-02-W10-4532691-en-Windows Server 2019 Standard-Gold' from analysis results (based on the patch exclude list for server win19-894p3.example.com)

                         

                         

                        *******************************************************

                        ****************** win16-2002.example.com **********************

                        Type: Info Date: Fri Aug 28 17:21:53 EDT 2020 Message: Copying metadata WindowsPatchData.zip to the server: win16-2002.example.com

                        Type: Info Date: Fri Aug 28 17:21:54 EDT 2020 Message: Metadata WindowsPatchData.zip copied to the server: win16-2002.example.com

                        Type: Info Date: Fri Aug 28 17:21:54 EDT 2020 Message: Starting analyzer execution on server: win16-2002.example.com

                        Type: Info Date: Fri Aug 28 17:22:09 EDT 2020 Message: Analyzer execution complete on server: win16-2002.example.com , exitCode: 0

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Copying analysis results xml from server: win16-2002.example.com

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Parsing analysis results for server: win16-2002.example.com

                        Type: Info Date: Fri Aug 28 17:22:11 EDT 2020 Message: Creating analysis result items for server: win16-2002.example.com

                         

                         

                        *******************************************************