Automatically export log bundles for job error

  • 1 March 2022
  • 1 reply
  • 252 views

Userlevel 2
Badge +3

This is simple but working trick to maintain Commvault.

Backup jobs might fail at night and you'd like to find out the cause of errors, you need to collect log bundles in the first place.
But when you realize the errors after a while (say couple of days later), job logs might be rolled over, important information which would contain the error messages gone.

To avoid this situation, you can setup various alerts, collect logs immediately after you receive any.
This also cumbersome so you can introduce simple workflow which can be called at the same timing of alert, also collect logs automatically.

Rough process as follows:

  1. Generate an answer file for "Send Log Files".
    This procedure is utilizing Save as Script, which can be saved most of user operations with parameters, generates .bat file and XML file.
    The latter is called Answer file which contains the actual operaiton parameters in single file.
    To export this, you can start "Send Log Files" process from CommCell Console:


    Then you're getting the following dialog:


    Choose "Jobs" and put arbitrary number which you can easily identify in XML file later:


    Include "CommServe Database" along with "Get Latest Database(s)":


    Specify output location folder for log bundles:


    Then "Save As Script":


    This generates 2 files like the following, open XML file (and dispose .bat):


    Inside the XML file you can find 2 important parameters, JobID (multipleJobIds) and log directory (saveToLogDir):

  2. Create workflow
    This workflow contains 2 factor:
    a. input parameter for Job ID


    b. an Activity for Qcommands => Operation => Execute, which is equivalent to qoperation execute:


    This activity's "Input XML" should have the same content of the XML file generated above, but need to modify a bit, to replace dummy JobID to workflow input parameter:

  3. You can put any logic in this workflow as you like.

  4. Generate Alert
    Assume you have this workflow now:


    Create an alert and specify this workflow as follows, Notification Type(s) Selection as "Workflow", and choose this workflow, and <JOB ID> as input parameter:

  5.  

 

That's all, after that you can obtain log bundles automatically when this alert is triggered.
Note that, this procedure is just outline so typically you need to consider a bit more detail, like housekeeping of log directory generated, excluding CommServe DB dump from log bundle (at least not every time), etc.

Hope this helps 


If you have a question or comment, please create a topic

1 reply

Badge +2

Thanks, love these types of tips to make my day easier.