How To: Archive Reports and Logs in Jenkins

If the customer is experiencing a problem with their Datical installation, having access to past logs and reports from the jobs that failed can be very beneficial to the support team while researching the support request.

There is a balance to strike with archiving reports and logs. On one hand, the more historical data we have the better it will be for troubleshooting the problem.  On the other hand, since these archives take up disk space, the customer may want to economize the use of that space by only keeping a certain number of logs, or past logs for only a certain amount of time before they are overwritten. 

This document aims to help the customer configure their Jenkins jobs to archive the proper number and age of reports and balance these considerations to match their specific business needs.

Step-by-step guide

For jobs that are set up in Jenkins

  1. Configure the job to handle archives correctly
    1. Open the configuration of your Jenkins job by clicking on the job and then clicking the "Configure" button 
    2. In the General section select the checkbox next to "Discard old builds"
    3. This will expand a section where you can provide additional configuration
    4. "Strategy" should be set to "Log Rotation"
    5. Enter the number of days to keep old builds - Builds older than this number of days will be overwritten
    6. Enter the maximum number of builds you wish to keep - If there are already this many builds stored, the oldest will be overwritten by the current build
    7. "Days to keep artifacts" and "Max # of builds to keep with artifacts" do the same as e and f above, but for artifacts specifically

  2. Archive the artifacts after the build:
    1. In the "Post-build Actions" section, select "Add post-build action" > "Archive the artifacts"
    2. In "Files to archive" enter the string **/daticaldb.log, **/Reports/**, **/Logs/**, **/Snapshots/**
      1. This tells Jenkins to keep all of the files called daticaldb.log as well as the contents of the /Reports, /Logs and /Snapshots directories
    3. Click "Advanced" for optional configurations
    4. Click the Save button



Copyright © Datical 2012-2020 - Proprietary and Confidential