DevOps

Jenkins CONFIGURING LOGGING

Log files serve as indispensable resources for any system administrator, regardless of the system in question. Jenkins amplifies logging capabilities through the use of the Audit Trail plugin.

To integrate the Audit Trail plugin:

  1. Install the Audit Trail plugin from the plugin manager, following the same procedure as previous plugin installations.
  2. Post-installation, proceed to Configure Jenkins and navigate to the Audit Trail section.
  3. Click the “Add Logger” button and select “log file”.

The log file offers various configurable options to align with your requirements, including:

  • Log location: Specify the path where the log file(s) should be stored, ensuring accessibility by the Jenkins user. Jenkins facilitates placeholders for automatic file naming:
  • %g: Automatically generates a number for the file. For instance, audit%g.log translates to audit1.log. If not provided, the filename defaults to containing the number at the end preceded by a dot.
  • %t: Corresponds to the system’s temp directory (/tmp for UNIX-based systems and c:\temp for Windows).
  • %h: Represents the user’s home directory.
  • %%: Inserts a literal percentage sign (%).
  • Log File Size: Define the maximum size a log file can reach before rotation. Log rotation involves renaming the current log file (usually with an incremental number or timestamp) and creating a new file for ongoing log entries. This process aids in conserving space by archiving or deleting older log files.
  • Log File Count: Specify the number of log files to retain.

For instance, setting the file path as %t/jenkins_%g.log would result in log files being stored in /tmp with the name “jenkins” followed by an incremental number and the .log extension appended.

Now, to enact a change in the global configuration, such as modifying the URL to http://127.0.0.1:8080 instead of http://localhost:8080:

  1. Navigate to /tmp.
  2. Locate the log file reflecting the committed action.
Ali Imran
Over the past 20+ years, I have been working as a software engineer, architect, and programmer, creating, designing, and programming various applications. My main focus has always been to achieve business goals and transform business ideas into digital reality. I have successfully solved numerous business problems and increased productivity for small businesses as well as enterprise corporations through the solutions that I created. My strong technical background and ability to work effectively in team environments make me a valuable asset to any organization.
https://ITsAli.com

Leave a Reply